Skip to content

Commit

Permalink
[FIX] public_budget_tax_settlement: compute amount residual
Browse files Browse the repository at this point in the history
Ticket: 57510
Computo el amount_residual de esta manera porque nunca lo termina computando acá https://github.com/odoo/odoo/blob/15.0/addons/account/models/account_move.py#L1477
  • Loading branch information
pablohmontenegro committed Dec 29, 2022
1 parent d7f04d3 commit 85f1b2b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
7 changes: 0 additions & 7 deletions public_budget/models/account_move.py
Expand Up @@ -188,10 +188,3 @@ def unlink(self):
self.filtered(lambda x: x.move_type in x.get_purchase_types() and x.state in (
'draft', 'cancel') and not x.l10n_latam_use_documents).write({'name': '/'})
return super().unlink()

def _payment_state_matters(self):
# TODO KZ si no funciona podriamos intentar con open_move_line_ids si esta definido y viene seteado.
self.ensure_one()
if self.settled_line_ids:
return True
return super()._payment_state_matters()
1 change: 0 additions & 1 deletion public_budget_tax_settlement/models/__init__.py
@@ -1,4 +1,3 @@
from . import account_move
from . import account_payment
from . import account_payment_group
from . import account_move_line
4 changes: 4 additions & 0 deletions public_budget_tax_settlement/models/account_move.py
Expand Up @@ -38,6 +38,10 @@ def action_pay_tax_settlement(self):

def _compute_matched_to_pay(self):
for rec in self:
if self.line_ids and not self.payment_state and self.state == 'posted' and self.open_move_line_ids:
amount_residual = sum(self.line_ids.mapped('amount_residual'))
if amount_residual != 0:
self.amount_residual = amount_residual
rec.enable_to_pay = True if rec.amount_residual != 0 else False

@api.model
Expand Down
14 changes: 0 additions & 14 deletions public_budget_tax_settlement/models/account_payment_group.py

This file was deleted.

0 comments on commit 85f1b2b

Please sign in to comment.