[12.0][IMP] - extend contract line at renewal

This commit is contained in:
sbejaoui
2019-12-20 11:12:51 +01:00
committed by Francisco Ivan Anton Prieto
parent becaad164f
commit 57f5df2a03
2 changed files with 33 additions and 2 deletions

View File

@@ -1188,6 +1188,12 @@ class ContractLine(models.Model):
new_line._onchange_date_start()
return new_line
@api.multi
def _renew_extend_line(self, date_end):
self.ensure_one()
self.date_end = date_end
return self
@api.multi
def renew(self):
res = self.env['contract.line']
@@ -1197,7 +1203,7 @@ class ContractLine(models.Model):
if company.create_new_line_at_contract_line_renew:
new_line = rec._renew_create_line(date_start, date_end)
else:
raise NotImplementedError
new_line = rec._renew_extend_line(date_end)
res |= new_line
msg = _(
"""Contract line for <strong>{product}</strong>