[FIX] account_check_printing: set the amount in words
- Create a vendor payment by check - Remove the amount in words - Confirm It is impossible to set the amount to print the check. We add an action button to recompute the amount in words. It is only visible when the amount is not set. opw-2046339 closes odoo/odoo#35968 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -119,3 +119,7 @@ class AccountPayment(models.Model):
|
||||
""" This method is a hook for l10n_xx_check_printing modules to implement actual check printing capabilities """
|
||||
raise UserError(_("There is no check layout configured.\nMake sure the proper check printing module is installed"
|
||||
" and its configuration (in company settings > 'Configuration' tab) is correct."))
|
||||
|
||||
def set_check_amount_in_words(self):
|
||||
for payment in self:
|
||||
payment.check_amount_in_words = payment.currency_id.amount_to_text(payment.amount) if payment.currency_id else ''
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<xpath expr="//button[@name='post']" position="before">
|
||||
<button name="print_checks" class="oe_highlight" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('state', '!=', 'posted')]}" string="Print Check" type="object"/>
|
||||
<button name="unmark_sent" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('state', '!=', 'sent')]}" string="Unmark Sent" type="object"/>
|
||||
<button name="set_check_amount_in_words" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('check_amount_in_words', '!=', False)]}" string="Reset Amount in Words" type="object" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='amount_div']" position="after">
|
||||
<field name="check_amount_in_words" attrs="{'invisible': [('payment_method_code', '!=', 'check_printing')], 'readonly': [('state', '!=', 'draft')]}" groups="base.group_no_one"/>
|
||||
|
||||
Reference in New Issue
Block a user