Skip to content

Commit

Permalink
[IMP] l10n_es_vat_prorate: Add hook for VAT prorate move line
Browse files Browse the repository at this point in the history
This way, you can inject any possible extra value.
  • Loading branch information
pedrobaeza committed Dec 9, 2024
1 parent 406c907 commit c8c8e63
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions l10n_es_vat_prorate/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ def _process_aeat_tax_fee_info(self, res, tax, sign):
res[tax]["deductible_amount"] -= self.balance * sign
return result

def _prepare_vat_prorate_key(self):
self.ensure_one()
return {
"vat_prorate": True,
"account_id": self.company_id._get_tax_prorrate_account_map().get(
self.account_id.account_type
)
or self.account_id.id,
"analytic_distribution": self.analytic_distribution,
}

@api.depends("with_vat_prorate")
def _compute_all_tax(self):
"""After getting normal taxes dict that is dumped into this field, we loop
Expand Down Expand Up @@ -100,16 +111,7 @@ def _compute_all_tax(self):
new_vals[field] -= tax_vals[field]
new_vals["vat_prorate"] = True
new_key = dict(tax_key)
new_key.update(
{
"vat_prorate": True,
"account_id": line.company_id._get_tax_prorrate_account_map().get(
line.account_id.account_type
)
or line.account_id.id,
"analytic_distribution": line.analytic_distribution,
}
)
new_key.update(line._prepare_vat_prorate_key())
new_key = frozendict(new_key)
if prorate_tax_list.get(new_key):
for field in {"amount_currency", "balance"}:
Expand Down

0 comments on commit c8c8e63

Please sign in to comment.