Skip to content
Snippets Groups Projects
Commit 286e512f authored by Adrien Widart's avatar Adrien Widart
Browse files

[FIX] l10n_mx: allow MX to print receipts


To reproduce the error:
(Need MX configuration)
1. Go to Accounting > Customers > Receipts
2. Create a Receipt
3. Post and Print it

Error: An error message is displayed: "Only invoices could be printed."
However, MX should be allowed to print the receipts.

OPW-2456374

closes odoo/odoo#66954

X-original-commit: 0f0238c6
Signed-off-by: default avatarAdrien Widart <adwid@users.noreply.github.com>
parent 620412fa
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,12 @@ msgstr ""
msgid "Nature"
msgstr ""
#. module: l10n_mx
#: code:addons/l10n_mx/models/account_move.py:0
#, python-format
msgid "Only invoices can be printed."
msgstr ""
#. module: l10n_mx
#: model:ir.model.fields,help:l10n_mx.field_account_setup_bank_manual_config__l10n_mx_edi_clabe
#: model:ir.model.fields,help:l10n_mx.field_res_partner_bank__l10n_mx_edi_clabe
......
......@@ -7,3 +7,4 @@ from . import account_tax
from . import res_bank
from . import res_config_settings
from . import chart_template
from . import account_move
# -*- coding: utf-8 -*-
from odoo import models, _
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = 'account.move'
def _get_report_base_filename(self):
self.ensure_one()
if (self.company_id.country_id and self.company_id.country_id.code) == 'MX':
if not self.is_invoice(include_receipts=True):
raise UserError(_("Only invoices can be printed."))
return self._get_move_display_name()
return super()._get_report_base_filename()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment