def METHOD_NAME(self):
    for inv in self:
        if not inv.tax_stamp:
            raise UserError(_("Tax stamp is not applicable"))
        stamp_product_id = self.env.company.with_context(
            lang=inv.partner_id.lang
        ).tax_stamp_product_id
        if not stamp_product_id:
            raise UserError(_("Missing tax stamp product in company settings!"))
        for line in inv.invoice_line_ids:
            if line.product_id and line.product_id.is_stamp:
                raise UserError(
                    _("Tax stamp line %s already present. Remove it first.")
                    % line.name
                )
        stamp_account = stamp_product_id.property_account_income_id
        if not stamp_account:
            raise UserError(
                _("Missing account income configuration for %s")
                % stamp_product_id.name
            )
        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,
            "quantity": 1,
            "product_uom_id": stamp_product_id.uom_id.id,
            "tax_ids": [(6, 0, stamp_product_id.taxes_id.ids)],
            "analytic_account_id": None,
        }
        inv.write({"invoice_line_ids": [(0, 0, invoice_line_vals)]})