Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] l10n_it_account_stamp: add stamp by comparing price in company currency #3713

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si suppone quindi che la valuta dell'azienda sia EUR, ma se non fosse così?
Credo sarebbe più corretto controllare prima che la valuta dell'azienda sia EUR, oppure controllare il valore convertito in EUR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

balance è nella valuta della company che non per forza deve essere EUR
stamp_apply_min_total_base questo campo in prodotto è un float che dovresti scrivere in base alla tua company, forse è proprio questo campo che ti può far supporre che l'azienda sia EUR

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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"currency_id",

Probabile che anche questo non serva più

"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
Loading