[FIX][14.0] tests & typo

This commit is contained in:
Mourad
2023-05-04 16:41:52 +02:00
parent 7f00957670
commit fae86d5180
4 changed files with 16 additions and 13 deletions

View File

@@ -83,15 +83,8 @@ class SaleOrder(models.Model):
contract_model = self.env["contract.contract"]
contracts = []
for rec in self.filtered("is_contract"):
line_to_create_contract = rec.order_line.filtered(
lambda r: not r.contract_id and r.is_contract
)
line_to_update_contract = rec.order_line.filtered(
lambda r: r.contract_id
and r.is_contract
and r
not in r.contract_id.contract_line_ids.mapped("sale_order_line_id")
)
line_to_create_contract = rec._get_line_to_create_contract()
line_to_update_contract = rec._get_line_to_update_contract()
contract_templates = self.env["contract.template"]
for order_line in line_to_create_contract:
contract_template = order_line.product_id.with_company(

View File

@@ -141,8 +141,8 @@ class SaleOrderLine(models.Model):
rec.date_end = rec._get_date_end() if rec.date_start else False
@api.onchange("product_id")
def onchange_product(self):
super().onchange_product()
def product_id_change(self):
super().product_id_change()
for rec in self:
if rec.product_id.is_contract:
rec.is_contract = True
@@ -270,7 +270,7 @@ class SaleOrderLine(models.Model):
)
@api.constrains("product_id", "contract_id")
def _check_contract_sale_contract_template(self):
def _check_contract_sale_line_is_contract(self):
for rec in self:
if rec.is_contract and not rec.product_id.is_contract:
raise ValidationError(