| 1 | # Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 | from odoo import models |
| 3 | |
| 4 | |
| 5 | class AccountMove(models.Model): |
| 6 | _inherit = 'account.move' |
| 7 | |
| 8 | def _get_name_invoice_report(self): |
| 9 | # Safety mechanism to avoid issues if the module has not yet been updated. |
| 10 | template = self.env.ref('l10n_nz.report_invoice_document', raise_if_not_found=False) |
| 11 | if template and self.company_id.account_fiscal_country_id.code == 'NZ': |
| 12 | return 'l10n_nz.report_invoice_document' |
| 13 | return super()._get_name_invoice_report() |