summaryrefslogtreecommitdiff
path: root/addons/account_check_printing/wizard
diff options
context:
space:
mode:
authorwan <wan@odoo.com>2020-08-17 10:14:09 +0000
committerwan <wan@odoo.com>2020-08-21 07:46:07 +0000
commit8129aa40dbb236b693b21724ebf0e57bc59dbc8b (patch)
treef7d5059bcac1bdc2af0ffd9ad570251f5c9f9eef /addons/account_check_printing/wizard
parenteb6a177a50128f2d78607fcff36aaf65e8a3034e (diff)
[IMP] account{,_check_printing}: usability
Task 2005940 account: * Use stored compute methods instead of default for {out,in}bound_payment_method_ids * Track is_move_sent in the chatter * Split 'Invoices' and 'Bills' in the smart button of payment form * Because account.payment.method can be shown on the res.partner form, we need to relax the security level to readonly for all users account_check_printing: * Add the preferred payment method for partners, with a related on account move allowing to do a group by and doing payments in batch * Add a constraint to forbid twice the same check number in the same journal * The amount in words is now readonly to prevent typos and mismatches with the amount in digits * Remove the field `check_number_int`. The check number is kept as Char so that '000012345' is not displayed (and printed) as '12,345' but it is parsed so that comparison and incrementation are possible. closes odoo/odoo#56179 Related: odoo/upgrade#1669 Related: odoo/enterprise#12527 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/account_check_printing/wizard')
-rw-r--r--addons/account_check_printing/wizard/print_prenumbered_checks.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/account_check_printing/wizard/print_prenumbered_checks.py b/addons/account_check_printing/wizard/print_prenumbered_checks.py
index 416ab4a1a11..84d4f10a9d7 100644
--- a/addons/account_check_printing/wizard/print_prenumbered_checks.py
+++ b/addons/account_check_printing/wizard/print_prenumbered_checks.py
@@ -20,10 +20,11 @@ class PrintPreNumberedChecks(models.TransientModel):
def print_checks(self):
check_number = int(self.next_check_number)
+ number_len = len(self.next_check_number or "")
payments = self.env['account.payment'].browse(self.env.context['payment_ids'])
payments.filtered(lambda r: r.state == 'draft').action_post()
payments.filtered(lambda r: r.state == 'posted' and not r.is_move_sent).write({'is_move_sent': True})
for payment in payments:
- payment.check_number = check_number
+ payment.check_number = '%0{}d'.format(number_len) % check_number
check_number += 1
return payments.do_print_checks()