diff --git a/addons/l10n_br/__init__.py b/addons/l10n_br/__init__.py index 8d88c888d80..1f90fcdb412 100644 --- a/addons/l10n_br/__init__.py +++ b/addons/l10n_br/__init__.py @@ -1,3 +1,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import demo from . import models from . import wizard diff --git a/addons/l10n_br/demo/__init__.py b/addons/l10n_br/demo/__init__.py new file mode 100644 index 00000000000..7eaefb929bf --- /dev/null +++ b/addons/l10n_br/demo/__init__.py @@ -0,0 +1 @@ +from . import account_demo diff --git a/addons/l10n_br/demo/account_demo.py b/addons/l10n_br/demo/account_demo.py new file mode 100644 index 00000000000..13bdf37c151 --- /dev/null +++ b/addons/l10n_br/demo/account_demo.py @@ -0,0 +1,20 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from odoo import models, api + + +class AccountChartTemplate(models.AbstractModel): + _inherit = 'account.chart.template' + + @api.model + def _get_demo_data_move(self, company=False): + """ Set the l10n_latam_document_number on demo invoices """ + move_data = super()._get_demo_data_move(company) + if company.account_fiscal_country_id.code == 'BR': + number = 0 + for move in move_data.values(): + # vendor bills must be manually numbered (l10n_br uses the standard AccountMove._is_manual_document_number()) + if move['move_type'] == 'in_invoice': + move['l10n_latam_document_number'] = f'{number:08d}' + number += 1 + + return move_data diff --git a/addons/l10n_br/models/template_br.py b/addons/l10n_br/models/template_br.py index 945bcfab87d..b48ff833a8f 100644 --- a/addons/l10n_br/models/template_br.py +++ b/addons/l10n_br/models/template_br.py @@ -1,5 +1,5 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import models, api +from odoo import models from odoo.addons.account.models.chart_template import template @@ -39,18 +39,8 @@ class AccountChartTemplate(models.AbstractModel): @template('br', 'account.journal') def _get_br_account_journal(self): return { - 'sale': {'l10n_br_invoice_serial': '1'}, + 'sale': { + 'l10n_br_invoice_serial': '1', + 'refund_sequence': False, + }, } - - @api.model - def _get_demo_data_move(self, company=False): - move_data = super()._get_demo_data_move(company) - if company.account_fiscal_country_id.code == 'BR': - number = 0 - for move in move_data.values(): - # vendor bills must be manually numbered (l10n_br uses the standard AccountMove._is_manual_document_number()) - if move['move_type'] == 'in_invoice': - move['l10n_latam_document_number'] = f'{number:08d}' - number += 1 - - return move_data diff --git a/addons/l10n_br/views/account_journal_views.xml b/addons/l10n_br/views/account_journal_views.xml index e0ae12f1000..ac5a82e28d6 100644 --- a/addons/l10n_br/views/account_journal_views.xml +++ b/addons/l10n_br/views/account_journal_views.xml @@ -6,7 +6,7 @@ account.journal.form - +