From 423747ef4a724561d61e46d09b0284d1f2967e64 Mon Sep 17 00:00:00 2001 From: Saurabh Mishra Date: Thu, 9 Feb 2023 06:16:42 +0000 Subject: [PATCH] [FIX] l10n_in_edi_ewaybill: Deactivated E-Invoice (IN) edi before load demodata Deactivated demo data in l10n_in_edi_ewaybill module for demo E-Waybill Company Runbot Nightly build give error: https://runbot.odoo.com/runbot/build/23714129 closes odoo/odoo#112375 X-original-commit: 3a05bbb16f8103e2559d7b2daff09dc44e1dc645 Signed-off-by: Josse Colpaert --- addons/l10n_in_edi_ewaybill/__init__.py | 1 + addons/l10n_in_edi_ewaybill/demo/__init__.py | 4 ++++ .../l10n_in_edi_ewaybill/demo/chart_template.py | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 addons/l10n_in_edi_ewaybill/demo/__init__.py create mode 100644 addons/l10n_in_edi_ewaybill/demo/chart_template.py 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()