[FIX]project_timesheet, sale: SO line not updated after timesheet is deleted
-Deleting some timesheets linked to a task created on a SO didn't update the delivred quantity. opw:697317
This commit is contained in:
@@ -18,6 +18,11 @@ class SaleOrderLine(models.Model):
|
||||
domain,
|
||||
['so_line', 'unit_amount', 'product_uom_id'], ['product_uom_id', 'so_line'], lazy=False
|
||||
)
|
||||
# If the unlinked analytic line was the last one on the SO line, the qty was not updated.
|
||||
force_so_lines = self.env.context.get("force_so_lines")
|
||||
if force_so_lines:
|
||||
for line in force_so_lines:
|
||||
lines.setdefault(line, 0.0)
|
||||
for d in data:
|
||||
if not d['product_uom_id']:
|
||||
continue
|
||||
@@ -124,3 +129,10 @@ class AccountAnalyticLine(models.Model):
|
||||
line.with_context(create=True).write(res)
|
||||
line.mapped('so_line').sudo()._compute_analytic()
|
||||
return line
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
so_lines = self.mapped('so_line')
|
||||
res = super(AccountAnalyticLine, self).unlink()
|
||||
so_lines.with_context(force_so_lines=so_lines).sudo()._compute_analytic()
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user