Skip to content

Commit

Permalink
[FIX] l10n_it_account_stamp: add stamp by comparing price in company …
Browse files Browse the repository at this point in the history
…currency
  • Loading branch information
Borruso committed Nov 17, 2023
1 parent b8dd68a commit 43c6024
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions l10n_it_account_stamp/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def is_tax_stamp_applicable(self):
raise UserError(_("Missing tax stamp product in company settings!"))
total_tax_base = sum(
(
inv_tax.price_subtotal
abs(inv_tax.balance)
for inv_tax in self.line_ids.filtered(
lambda line: set(line.tax_ids.ids)
& set(stamp_product_id.stamp_apply_tax_ids.ids)
Expand All @@ -32,14 +32,13 @@ def is_tax_stamp_applicable(self):
return total_tax_base >= stamp_product_id.stamp_apply_min_total_base

@api.depends(
"invoice_line_ids.price_subtotal",
"line_ids.price_total",
"line_ids.balance",
"currency_id",
"company_id",
"invoice_date",
"move_type",
"manually_apply_tax_stamp",
"invoice_line_ids.tax_ids",
"line_ids.tax_ids",
)
def _compute_tax_stamp(self):
for invoice in self:
Expand Down Expand Up @@ -71,13 +70,16 @@ def add_tax_stamp_line(self):
_("Missing account income configuration for %s")
% stamp_product_id.name
)
price_unit = inv.company_currency_id._convert(
stamp_product_id.list_price, inv.currency_id, inv.company_id, inv.date
)
invoice_line_vals = {
"move_id": inv.id,
"product_id": stamp_product_id.id,
"name": stamp_product_id.description_sale,
"sequence": 99999,
"account_id": stamp_account.id,
"price_unit": stamp_product_id.list_price,
"price_unit": price_unit,
"quantity": 1,
"display_type": "product",
"product_uom_id": stamp_product_id.uom_id.id,
Expand Down

0 comments on commit 43c6024

Please sign in to comment.