[FIX] - don't play onchange date_start for old lines on contract template change

[FIX] - Fix stop post message

[FIX] - Fix sale_contract_count should count all partner contract

[FIX] - set recurring_next_date to False if contract line stoped at last date invoiced

[FIX] - Group by next_invoice also considers dates in the past
This commit is contained in:
sbejaoui
2019-03-14 16:00:16 +01:00
committed by Francisco Ivan Anton Prieto
parent 5248e17bab
commit 5c8c875b61
5 changed files with 17 additions and 14 deletions

View File

@@ -658,8 +658,16 @@ class AccountAnalyticInvoiceLine(models.Model):
rec.cancel()
else:
if not rec.date_end or rec.date_end > date_end:
old_date_end = rec.date_end
values = {
'date_end': date_end,
'is_auto_renew': False,
'manual_renew_needed': manual_renew_needed,
}
if rec.last_date_invoiced == date_end:
values['recurring_next_date'] = False
rec.write(values)
if post_message:
old_date_end = rec.date_end
msg = _(
"""Contract line for <strong>{product}</strong>
stopped: <br/>
@@ -671,13 +679,6 @@ class AccountAnalyticInvoiceLine(models.Model):
)
)
rec.contract_id.message_post(body=msg)
rec.write(
{
'date_end': date_end,
'is_auto_renew': False,
"manual_renew_needed": manual_renew_needed,
}
)
else:
rec.write(
{