Merge branch 'new/15.0/H11047_timesheet_exception__add_eceptions' into '15.0-test'

new/15.0/H11047_timesheet_exception__add_eceptions into 15.0-test

See merge request hibou-io/hibou-odoo/suite!1500
This commit is contained in:
Hibou Bot
2022-10-06 18:27:22 +00:00
2 changed files with 5 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
<field name="description">Unit amount over 8 hrs</field>
<field name="sequence">50</field>
<field name="model">account.analytic.line</field>
<field name="code">if self.unit_amount > 8: failed=True</field>
<field name="code">failed = self._context.get("newVals", {}).get("validated", False) == True and self.unit_amount > 8</field>
<field name="active" eval="True"/>
</record>
@@ -15,7 +15,7 @@
<field name="description">SO delivered qty plus unit amount exceeds ordered qty</field>
<field name="sequence">50</field>
<field name="model">account.analytic.line</field>
<field name="code">if self.so_line.product_template_id.service_policy == 'ordered_timesheet' and self.so_line.qty_delivered + self.unit_amount > self.so_line.product_uom_qty: failed=True</field>
<field name="code">failed = self._context.get("newVals", {}).get("validated", False) == True and (self.so_line.product_template_id.service_policy == 'ordered_timesheet' and self.so_line.qty_delivered + self.unit_amount > self.so_line.product_uom_qty)</field>
<field name="active" eval="True"/>
</record>

View File

@@ -34,10 +34,10 @@ class AnalyticLine(models.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() and 'stage_id' in vals:
for timesheet in self:
if timesheet.with_context(newVals=vals).detect_exceptions():
return self._popup_exceptions()
return super().write(vals)