diff options
| -rw-r--r-- | addons/account_check_printing/models/account_payment.py | 10 | ||||
| -rw-r--r-- | addons/account_check_printing/models/res_company.py | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 52bd7dc6149..85b01c5491e 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -96,8 +96,14 @@ class AccountPayment(models.Model): self.write({'state': 'posted'}) def do_print_checks(self): - """ This method is a hook for l10n_xx_check_printing modules to implement actual check printing capabilities """ - raise UserError(_("You have to choose a check layout. For this, go in Apps, search for 'Checks layout' and install one.")) + check_layout = self[0].company_id.account_check_printing_layout + if check_layout == 'disabled': + raise UserError(_("You have to choose a check layout. For this, go in Invoicing/Accounting Settings, search for 'Checks layout' and set one.")) + report_action = self.env.ref(check_layout, False) + if not report_action: + raise UserError(_("Something went wrong with Check Layout, please select another layout in Invoicing/Accounting Settings and try again.")) + self.write({'state': 'sent'}) + return report_action.report_action(self) def set_check_amount_in_words(self): diff --git a/addons/account_check_printing/models/res_company.py b/addons/account_check_printing/models/res_company.py index fb985473744..bf6c584ae06 100644 --- a/addons/account_check_printing/models/res_company.py +++ b/addons/account_check_printing/models/res_company.py @@ -5,16 +5,15 @@ from odoo import models, api, fields class res_company(models.Model): _inherit = "res.company" + # This field needs to be overridden with `selection_add` in the modules which intends to add report layouts. + # The xmlID of all the report actions which are actually Check Layouts has to be kept as key of the selection. account_check_printing_layout = fields.Selection(string="Check Layout", required=True, help="Select the format corresponding to the check paper you will be printing your checks on.\n" "In order to disable the printing feature, select 'None'.", selection=[ - ('disabled', 'None'), - ('action_print_check_top', 'check on top'), - ('action_print_check_middle', 'check in middle'), - ('action_print_check_bottom', 'check on bottom') + ('disabled', 'None') ], - default="action_print_check_top") + default='disabled') account_check_printing_date_label = fields.Boolean('Print Date Label', default=True, help="This option allows you to print the date label on the check as per CPA. Disable this if your pre-printed check includes the date label.") |
