Browse Source

[IMP] - Add forecast trigger for contract update

pull/283/head
sbejaoui 6 years ago
parent
commit
bfa5d366b2
  1. 18
      contract_forecast/models/contract.py

18
contract_forecast/models/contract.py

@ -22,3 +22,21 @@ class AccountAnalyticAccount(models.Model):
"view_mode": "pivot,tree",
"context": context,
}
@api.model
def _get_forecast_update_trigger_fields(self):
return []
@api.multi
def write(self, values):
res = super(AccountAnalyticAccount, self).write(values)
if any(
[
field in values
for field in self._get_forecast_update_trigger_fields()
]
):
for rec in self:
for contract_line in rec.recurring_invoice_line_ids:
contract_line.with_delay()._generate_forecast_periods()
return res
Loading…
Cancel
Save