diff --git a/l10n_it_account_stamp/models/account_move.py b/l10n_it_account_stamp/models/account_move.py
index fac2a1555300..800c786349fc 100644
--- a/l10n_it_account_stamp/models/account_move.py
+++ b/l10n_it_account_stamp/models/account_move.py
@@ -7,7 +7,16 @@
class AccountMove(models.Model):
_inherit = "account.move"
- tax_stamp = fields.Boolean(readonly=False, compute="_compute_tax_stamp", store=True)
+ tax_stamp = fields.Boolean(
+ help="Tax stamp is applied to this invoice.",
+ readonly=False,
+ compute="_compute_tax_stamp",
+ store=True,
+ )
+ tax_stamp_line_present = fields.Boolean(
+ "Stamp line is present in invoice",
+ compute="_compute_tax_stamp_line_present",
+ )
auto_compute_stamp = fields.Boolean(
related="company_id.tax_stamp_product_id.auto_compute"
)
@@ -86,11 +95,21 @@ def add_tax_stamp_line(self):
inv.write({"invoice_line_ids": [(0, 0, invoice_line_vals)]})
def is_tax_stamp_line_present(self):
+ self.ensure_one()
for line in self.line_ids:
if line.is_stamp_line:
return True
return False
+ @api.depends(
+ "invoice_line_ids",
+ "invoice_line_ids.product_id",
+ "invoice_line_ids.product_id.is_stamp",
+ )
+ def _compute_tax_stamp_line_present(self):
+ for invoice in self:
+ invoice.tax_stamp_line_present = invoice.is_tax_stamp_line_present()
+
def is_tax_stamp_product_present(self):
product_stamp = self.invoice_line_ids.filtered(
lambda line: line.product_id.is_stamp
diff --git a/l10n_it_account_stamp/views/account_move_view.xml b/l10n_it_account_stamp/views/account_move_view.xml
index 7fa611d868fa..7ad06898a871 100644
--- a/l10n_it_account_stamp/views/account_move_view.xml
+++ b/l10n_it_account_stamp/views/account_move_view.xml
@@ -23,22 +23,37 @@
name="manually_apply_tax_stamp"
attrs="{'invisible': [('auto_compute_stamp', '=', True)]}"
/>
+
-
-
-
-
+ >
+
+
+
+
+
+
+ Stamp can only be charged to customer when invoice is in draft state
+
+
+
+ Stamp charged to customer
+
+