Skip to content

Commit

Permalink
Merge branch '14.0-fix-l10n_it_account_stamp-purchase-invoice' of git…
Browse files Browse the repository at this point in the history
…+ssh://github.com/efatto/l10n-italy into 14.0
  • Loading branch information
Pretecno committed Oct 30, 2024
2 parents 4c86fa9 + 1f7157b commit f3cfdc3
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions l10n_it_account_stamp/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ def add_tax_stamp_line(self):
_("Tax stamp line %s already present. Remove it first.")
% line.name
)
stamp_account = stamp_product_id.property_account_income_id
is_sale = bool(inv.move_type in ["out_invoice", "out_refund"])
stamp_account = (
stamp_product_id.property_account_income_id
if is_sale
else stamp_product_id.property_account_expense_id
)
if not stamp_account:
raise UserError(
_("Missing account income configuration for %s")
Expand All @@ -86,13 +91,23 @@ def add_tax_stamp_line(self):
"move_id": inv.id,
"product_id": stamp_product_id.id,
"is_stamp_line": True,
"name": stamp_product_id.description_sale,
"name": stamp_product_id.description_sale
if is_sale
else stamp_product_id.description_purchase,
"sequence": 99999,
"account_id": stamp_account.id,
"price_unit": stamp_product_id.list_price,
"quantity": 1,
"product_uom_id": stamp_product_id.uom_id.id,
"tax_ids": [(6, 0, stamp_product_id.taxes_id.ids)],
"tax_ids": [
(
6,
0,
stamp_product_id.taxes_id.ids
if is_sale
else stamp_product_id.supplier_taxes_id.ids,
)
],
"analytic_account_id": None,
}
inv.write({"invoice_line_ids": [(0, 0, invoice_line_vals)]})
Expand Down

0 comments on commit f3cfdc3

Please sign in to comment.