mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX][14.0] tests & typo
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user