[ADD]pms: pricelist pms enabled configuration

This commit is contained in:
Darío Lodeiros
2022-11-20 10:13:00 +01:00
parent 559a01cfea
commit 098e040b60
13 changed files with 77 additions and 9 deletions

View File

@@ -925,3 +925,21 @@ class ResPartner(models.Model):
):
return True
return False
@api.constrains("is_agency", "property_product_pricelist")
def _check_agency_pricelist(self):
if any(
record.is_agency and not record.property_product_pricelist.is_pms_available
for record in self
):
raise models.ValidationError(
_(
"""
Agency must have a PMS pricelist, please review the
pricelists configuration (%s) to allow it for PMS,
or the pricelist selected for the agencies: %s
"""
),
",".join(self.mapped("property_product_pricelis.name")),
"".join(self.mapped("name")),
)