diff --git a/addons/l10n_in_edi_ewaybill/__init__.py b/addons/l10n_in_edi_ewaybill/__init__.py index dc5e6b693d1..5320d2b35d0 100755 --- a/addons/l10n_in_edi_ewaybill/__init__.py +++ b/addons/l10n_in_edi_ewaybill/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import models +from . import demo diff --git a/addons/l10n_in_edi_ewaybill/demo/__init__.py b/addons/l10n_in_edi_ewaybill/demo/__init__.py new file mode 100644 index 00000000000..5514ac3be98 --- /dev/null +++ b/addons/l10n_in_edi_ewaybill/demo/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import chart_template diff --git a/addons/l10n_in_edi_ewaybill/demo/chart_template.py b/addons/l10n_in_edi_ewaybill/demo/chart_template.py new file mode 100644 index 00000000000..86e7cf5f35f --- /dev/null +++ b/addons/l10n_in_edi_ewaybill/demo/chart_template.py @@ -0,0 +1,17 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, api, Command + + +class AccountChartTemplate(models.Model): + _inherit = 'account.chart.template' + + @api.model + def _get_demo_data(self): + """We need to deactivate einvoice here, as we can not send e-invoice and e-waybill in the same demo company""" + if self.env.company == self.env.ref('l10n_in_edi_ewaybill.demo_company_in_ewaybill'): + val = self.env['account.journal'].search([ + ('type', '=', 'sale'), + ('company_id', '=', self.env.ref('l10n_in_edi_ewaybill.demo_company_in_ewaybill').id)]) + val.write({'edi_format_ids': [Command.unlink(self.env.ref('l10n_in_edi.edi_in_einvoice_json_1_03').id)]}) + return super()._get_demo_data()