[IMP] timesheet_exception: narrow down when to _popup_exceptions() on write() calls

H11047
This commit is contained in:
percyhibou
2022-10-06 08:14:44 +00:00
parent 368dc65b4e
commit 6cdc24609f
3 changed files with 7 additions and 13 deletions

View File

@@ -30,20 +30,14 @@ class AnalyticLine(models.Model):
res.detect_exceptions()
return res
@api.model
def _exception_rule_eval_context(self, rec):
res = super(AnalyticLine, self)._exception_rule_eval_context(rec)
res['timesheet'] = rec
return res
@api.model
def _reverse_field(self):
return 'timesheet_ids'
def write(self, vals):
def write(self, vals):
if not vals.get('ignore_exception'):
for timesheet in self:
if timesheet.detect_exceptions():
if timesheet.detect_exceptions() and 'stage_id' in vals:
return self._popup_exceptions()
return super().write(vals)