[FIX] exp_budget_check: use mapped for non relational field

This commit is contained in:
Abdurrahman Saber 2025-10-09 13:15:48 +03:00
parent b0413c38a1
commit 62b39f31ce
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ class AccountMove(models.Model):
lambda x: x.general_budget_id in budget_post and
x.crossovered_budget_id.state == 'done' and
x.date_from <= self.invoice_date <= x.date_to)
amount = budget_lines.confirm
amount = sum(budget_lines.mapped('confirm'))
amount += (line.price_subtotal + line.price_tax)
budget_lines.write({'confirm': amount})
budget_lines.write({'reserve': abs((line.price_subtotal + line.price_tax) - budget_lines.reserve)})
@ -167,7 +167,7 @@ class AccountMove(models.Model):
lambda x: x.general_budget_id in budget_post and
x.crossovered_budget_id.state == 'done' and
fields.Date.from_string(x.date_from) <= date <= fields.Date.from_string(x.date_to))
amount = budget_lines.confirm
amount = sum(budget_lines.mapped('confirm'))
amount -= (line.price_subtotal + line.price_tax)
budget_lines.write({'confirm': amount})
return res