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 Jul 26, 2024
1 parent 2473e77 commit b5fd4b1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions l10n_it_account_stamp/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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 @@ -42,14 +42,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 @@ -81,14 +80,18 @@ def add_tax_stamp_line(self):
_("Missing account income configuration for %s")
% stamp_product_id.name
)
currency_id = stamp_product_id.currency_id or inv.company_currency_id
price_unit = 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,
"is_stamp_line": True,
"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 b5fd4b1

Please sign in to comment.