Merge pull request #4850 from expsa/abdulrahman_dev_odex25_accounting

[FIX] exp_budget_check: use mapped for non relational field
This commit is contained in:
abdurrahman-saber 2025-10-09 13:16:49 +03:00 committed by GitHub
commit d69708164b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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