mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] timesheet_exception: modify code to check "validated" is set in "vals"
H11047
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<field name="description">Unit amount over 8 hrs</field>
|
<field name="description">Unit amount over 8 hrs</field>
|
||||||
<field name="sequence">50</field>
|
<field name="sequence">50</field>
|
||||||
<field name="model">account.analytic.line</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"/>
|
<field name="active" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<field name="description">SO delivered qty plus unit amount exceeds ordered qty</field>
|
<field name="description">SO delivered qty plus unit amount exceeds ordered qty</field>
|
||||||
<field name="sequence">50</field>
|
<field name="sequence">50</field>
|
||||||
<field name="model">account.analytic.line</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"/>
|
<field name="active" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class AnalyticLine(models.Model):
|
|||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
if not vals.get('ignore_exception'):
|
if not vals.get('ignore_exception'):
|
||||||
for timesheet in self:
|
for timesheet in self:
|
||||||
if timesheet.detect_exceptions() and 'stage_id' in vals:
|
if timesheet.with_context(newVals=vals).detect_exceptions():
|
||||||
return self._popup_exceptions()
|
return self._popup_exceptions()
|
||||||
return super().write(vals)
|
return super().write(vals)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user