mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Property listprice rules in services
This commit is contained in:
@@ -295,12 +295,17 @@ class PmsService(models.Model):
|
||||
@api.depends("service_line_ids", "service_line_ids.day_qty")
|
||||
def _compute_product_qty(self):
|
||||
self.product_qty = 0
|
||||
_logger.info("B")
|
||||
for service in self.filtered("service_line_ids"):
|
||||
qty = sum(service.service_line_ids.mapped("day_qty"))
|
||||
service.product_qty = qty
|
||||
|
||||
@api.depends("product_id", "service_line_ids", "reservation_id.pricelist_id")
|
||||
@api.depends(
|
||||
"product_id",
|
||||
"service_line_ids",
|
||||
"reservation_id.pricelist_id",
|
||||
"reservation_id.pms_property_id",
|
||||
"pms_property_id",
|
||||
)
|
||||
def _compute_price_unit(self):
|
||||
for service in self:
|
||||
folio = service.folio_id
|
||||
@@ -352,6 +357,7 @@ class PmsService(models.Model):
|
||||
pricelist=pricelist.id,
|
||||
uom=service.product_id.uom_id.id,
|
||||
fiscal_position=False,
|
||||
property=service.pms_property_id.id,
|
||||
)
|
||||
service.price_unit = self.env[
|
||||
"account.tax"
|
||||
@@ -378,7 +384,11 @@ class PmsService(models.Model):
|
||||
folio_new = self.folio_id
|
||||
reservation_new = self.reservation_id
|
||||
new = reservation_new if reservation_new else folio_new
|
||||
price_fields = ["pricelist_id", "reservation_type"]
|
||||
price_fields = [
|
||||
"pricelist_id",
|
||||
"reservation_type",
|
||||
"pms_property_id",
|
||||
]
|
||||
if (
|
||||
any(origin[field] != new[field] for field in price_fields)
|
||||
or self._origin.price_unit == 0
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Copyright 2017 Alexandre Díaz
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
pms_property_ids = fields.Many2many(
|
||||
"pms.property", string="Properties", required=False, ondelete="restrict"
|
||||
)
|
||||
per_day = fields.Boolean("Unit increment per day")
|
||||
per_person = fields.Boolean("Unit increment per person")
|
||||
consumed_on = fields.Selection(
|
||||
[("before", "Before night"), ("after", "After night")],
|
||||
"Consumed",
|
||||
default="before",
|
||||
)
|
||||
daily_limit = fields.Integer("Daily limit")
|
||||
is_extra_bed = fields.Boolean("Is extra bed", default=False)
|
||||
show_in_calendar = fields.Boolean(
|
||||
"Show in Calendar",
|
||||
default=False,
|
||||
help="Specifies if the product is shown in the calendar information.",
|
||||
)
|
||||
Reference in New Issue
Block a user