summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2019-08-22 12:14:18 +0000
committerNicolas Martinelli <nim@odoo.com>2019-08-22 12:14:18 +0000
commite0c7a368580dfeac9af8dc3cb3a10fc33bf4b521 (patch)
treed4e62a91aadb938b063794c891e9776f69def734 /addons
parent06a516af408e499e53c94ab90ed16001b1af815f (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/account_check_printing/models/account_payment.py4
-rw-r--r--addons/account_check_printing/views/account_payment_views.xml1
2 files changed, 5 insertions, 0 deletions
diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py
index 37f3f1b9d53..b7d1189e4af 100644
--- a/addons/account_check_printing/models/account_payment.py
+++ b/addons/account_check_printing/models/account_payment.py
@@ -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 ''
diff --git a/addons/account_check_printing/views/account_payment_views.xml b/addons/account_check_printing/views/account_payment_views.xml
index f3836a44099..c592f8a1675 100644
--- a/addons/account_check_printing/views/account_payment_views.xml
+++ b/addons/account_check_printing/views/account_payment_views.xml
@@ -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"/>