[IMP] account_check_printing: make check printing generic
Now, if user intends to add a check layout for it's own country then he/she
will need to define a layout template and a report action associated to it.
The xmlID(s) of this report action(s) needs to set as key of
'account_check_printing_layout' selection field after redifining
it in it's own module.
Refer l10n_{ca/us}_check_printing modules.
closes odoo/odoo#35438
Task: 2030714
Closes: 35438
Related: odoo/enterprise#5007
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user