diff --git a/pms/__manifest__.py b/pms/__manifest__.py
index 6dc9d7624..396f9b312 100644
--- a/pms/__manifest__.py
+++ b/pms/__manifest__.py
@@ -94,6 +94,7 @@
"views/precheckin_portal_templates.xml",
"wizards/wizard_massive_changes.xml",
"wizards/wizard_advanced_filters.xml",
+ "wizards/folio_payment_link_views.xml",
"views/payment_transaction_views.xml",
"views/account_move_line_views.xml",
"report/proforma_report_templates.xml",
diff --git a/pms/models/account_move.py b/pms/models/account_move.py
index ffab6a17d..b193dd32d 100644
--- a/pms/models/account_move.py
+++ b/pms/models/account_move.py
@@ -282,8 +282,19 @@ class AccountMove(models.Model):
payments=to_propose, invoice=move
)
if to_reconcile:
- (pay_term_lines + to_reconcile).reconcile()
-
+ try:
+ (pay_term_lines + to_reconcile).reconcile()
+ except Exception as e:
+ message = (
+ _(
+ """
+ An error occurred while reconciling
+ the invoice with the payments: %s
+ """
+ )
+ % str(e)
+ )
+ move.message_post(body=message)
return True
def _post(self, soft=True):
diff --git a/pms/models/pms_property.py b/pms/models/pms_property.py
index 1b0c055cb..63ff0ee50 100644
--- a/pms/models/pms_property.py
+++ b/pms/models/pms_property.py
@@ -237,6 +237,11 @@ class PmsProperty(models.Model):
string="Image in checkin",
default=get_default_logo(),
)
+ block_create_past_reservations = fields.Boolean(
+ string="Block Create Past Reservations",
+ help="Block the creation of reservations in the past",
+ default=False,
+ )
@api.depends_context(
"checkin",
diff --git a/pms/models/pms_reservation_line.py b/pms/models/pms_reservation_line.py
index 56d334c06..2ef76e172 100644
--- a/pms/models/pms_reservation_line.py
+++ b/pms/models/pms_reservation_line.py
@@ -570,3 +570,10 @@ class PmsReservationLine(models.Model):
)
if duplicated:
raise ValidationError(_("Duplicated reservation line date"))
+
+ @api.constrains("date")
+ def _check_past_reservations(self):
+ for record in self:
+ if record.pms_property_id.block_create_past_reservations:
+ if record.date < fields.Date.today():
+ raise ValidationError(_("You can't create past reservations"))
diff --git a/pms/models/pms_service.py b/pms/models/pms_service.py
index 548f0b03d..8d94ec0e0 100644
--- a/pms/models/pms_service.py
+++ b/pms/models/pms_service.py
@@ -346,7 +346,7 @@ class PmsService(models.Model):
continue
product = service.product_id
consumed_on = product.consumed_on
- if product.per_day:
+ if product.per_day and consumed_on in ("before", "after"):
lines = []
day_qty = service._service_day_qty()
days_diff = (reservation.checkout - reservation.checkin).days
@@ -406,13 +406,18 @@ class PmsService(models.Model):
service.service_line_ids = lines
else:
if not service.service_line_ids:
+ target_date = (
+ reservation.checkin
+ if consumed_on == "checkin"
+ else reservation.checkout
+ )
price_unit = service._get_price_unit_line()
service.service_line_ids = [
(
0,
False,
{
- "date": fields.Date.today(),
+ "date": target_date,
"day_qty": day_qty,
"price_unit": price_unit,
},
diff --git a/pms/models/product_template.py b/pms/models/product_template.py
index 6af72dcc3..3b1b69733 100644
--- a/pms/models/product_template.py
+++ b/pms/models/product_template.py
@@ -31,7 +31,12 @@ class ProductTemplate(models.Model):
consumed_on = fields.Selection(
string="Consumed",
help="Indicates when the product is consumed",
- selection=[("before", "Before night"), ("after", "After night")],
+ selection=[
+ ("before", "All before night"),
+ ("after", "All after night"),
+ ("checkin", "Only first day"),
+ ("checkout", "Only last day"),
+ ],
default="before",
)
daily_limit = fields.Integer(
diff --git a/pms/models/res_partner.py b/pms/models/res_partner.py
index 3863bff41..47f604e33 100644
--- a/pms/models/res_partner.py
+++ b/pms/models/res_partner.py
@@ -34,6 +34,18 @@ class ResPartner(models.Model):
index=True,
)
default_commission = fields.Integer(string="Commission", help="Default commission")
+ commission_type = fields.Selection(
+ selection=[
+ ("included", "Commission Included in Price"),
+ ("subtract", "Commission Subtracts from Price"),
+ ],
+ string="Commission Type",
+ help="""
+ If select subtract commission, for automatic import of reservations,
+ the commission is calculated as price - (price * commission / 100)
+ """,
+ default="included",
+ )
apply_pricelist = fields.Boolean(
string="Apply Pricelist",
help="Indicates if agency pricelist is applied to his reservations",
diff --git a/pms/static/description/index.html b/pms/static/description/index.html
index b4c2b892e..3b16cc3b6 100644
--- a/pms/static/description/index.html
+++ b/pms/static/description/index.html
@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
+:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
+Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
-pre.code .ln { color: grey; } /* line numbers */
+pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@ span.option {
span.pre {
white-space: pre }
-span.problematic {
+span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -438,7 +439,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
This module is maintained by the OCA.
-

+
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
diff --git a/pms/views/pms_property_views.xml b/pms/views/pms_property_views.xml
index b70761089..415f26032 100644
--- a/pms/views/pms_property_views.xml
+++ b/pms/views/pms_property_views.xml
@@ -74,6 +74,9 @@
>
+
+
+
diff --git a/pms/views/res_partner_views.xml b/pms/views/res_partner_views.xml
index 5bbe305eb..2af01c6aa 100644
--- a/pms/views/res_partner_views.xml
+++ b/pms/views/res_partner_views.xml
@@ -82,6 +82,7 @@
name="sale_channel_id"
options="{'no_create': True,'no_open': True}"
/>
+