[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 <jco@odoo.com>
This commit is contained in:
Saurabh Mishra
2023-02-10 10:13:20 +01:00
committed by Jigar Vaghela
parent 8d05afd708
commit 423747ef4a
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -2,3 +2,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from . import demo
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import chart_template
@@ -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()