mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms constraint pricelist items daily & consumption dates
This commit is contained in:
@@ -146,13 +146,10 @@ class ProductPricelist(models.Model):
|
||||
for record in self:
|
||||
if record.item_ids:
|
||||
for item in record.item_ids:
|
||||
days_diff = (
|
||||
item.date_end_consumption - item.date_start_consumption
|
||||
).days
|
||||
if record.pricelist_type == "daily" and (
|
||||
item.compute_price != "fixed"
|
||||
or len(record.pms_property_ids) != 1
|
||||
or days_diff > 1
|
||||
or item.date_end_consumption != item.date_start_consumption
|
||||
):
|
||||
raise ValidationError(
|
||||
_(
|
||||
|
||||
@@ -870,9 +870,8 @@ class TestPmsPricelist(common.SavepointCase):
|
||||
"compute_price": "fixed",
|
||||
"applied_on": "0_product_variant",
|
||||
"product_id": self.room_type.product_id.id,
|
||||
"date_start_consumption": datetime.datetime.now(),
|
||||
"date_end_consumption": datetime.datetime.today()
|
||||
+ datetime.timedelta(days=1),
|
||||
"date_start_consumption": datetime.date.today(),
|
||||
"date_end_consumption": datetime.date.today(),
|
||||
}
|
||||
)
|
||||
self.pricelist_test = self.env["product.pricelist"].create(
|
||||
|
||||
Reference in New Issue
Block a user