mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[15.0][MIG] product_contract : Migration to 15.0
This commit is contained in:
@@ -18,7 +18,7 @@ class ContractLine(models.Model):
|
||||
)
|
||||
|
||||
def _prepare_invoice_line(self, move_form):
|
||||
res = super(ContractLine, self)._prepare_invoice_line(move_form)
|
||||
res = super()._prepare_invoice_line(move_form)
|
||||
if self.sale_order_line_id and res:
|
||||
res["sale_line_ids"] = [(6, 0, [self.sale_order_line_id.id])]
|
||||
return res
|
||||
|
||||
@@ -68,7 +68,7 @@ class ProductTemplate(models.Model):
|
||||
self.with_company(company).write(
|
||||
{"property_contract_template_id": False}
|
||||
)
|
||||
super().write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@api.constrains("is_contract", "type")
|
||||
def _check_contract_product_type(self):
|
||||
|
||||
@@ -94,8 +94,9 @@ class SaleOrder(models.Model):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"You must specify a contract "
|
||||
"template for '{}' product in '{}' company."
|
||||
).format(order_line.product_id.name, rec.company_id.name)
|
||||
"template for '%(order_line.product_id.name)s' "
|
||||
"product in '%(rec.company_id.name)s' company."
|
||||
)
|
||||
)
|
||||
contract_templates |= contract_template
|
||||
for contract_template in contract_templates:
|
||||
|
||||
@@ -43,8 +43,8 @@ class SaleOrderLine(models.Model):
|
||||
help="Specify if process date is 'from' or 'to' invoicing date",
|
||||
copy=False,
|
||||
)
|
||||
date_start = fields.Date(string="Date Start")
|
||||
date_end = fields.Date(string="Date End")
|
||||
date_start = fields.Date()
|
||||
date_end = fields.Date()
|
||||
|
||||
contract_line_id = fields.Many2one(
|
||||
comodel_name="contract.line",
|
||||
@@ -142,13 +142,13 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
@api.onchange("product_id")
|
||||
def product_id_change(self):
|
||||
super().product_id_change()
|
||||
for rec in self:
|
||||
if rec.product_id.is_contract:
|
||||
rec.is_contract = True
|
||||
else:
|
||||
# Don't initialize wrong values
|
||||
rec.is_contract = False
|
||||
return super().product_id_change()
|
||||
|
||||
def _get_contract_line_qty(self):
|
||||
"""Returns the quantity to be put on new contract lines."""
|
||||
|
||||
Reference in New Issue
Block a user