diff --git a/addons/l10n_in/__init__.py b/addons/l10n_in/__init__.py index dc5e6b693d1..5320d2b35d0 100644 --- a/addons/l10n_in/__init__.py +++ b/addons/l10n_in/__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/__manifest__.py b/addons/l10n_in/__manifest__.py index c6e18ddbe31..337a5bd19c7 100644 --- a/addons/l10n_in/__manifest__.py +++ b/addons/l10n_in/__manifest__.py @@ -47,9 +47,7 @@ Sheet, now only Vertical format has been permitted Which is Supported By Odoo. ], 'demo': [ 'demo/demo_company.xml', - 'demo/res_partner_demo.xml', 'demo/product_demo.xml', - 'demo/account_invoice_demo.xml', ], 'license': 'LGPL-3', } diff --git a/addons/l10n_in/demo/__init__.py b/addons/l10n_in/demo/__init__.py new file mode 100644 index 00000000000..979520bdf51 --- /dev/null +++ b/addons/l10n_in/demo/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import account_demo diff --git a/addons/l10n_in/demo/account_demo.py b/addons/l10n_in/demo/account_demo.py new file mode 100644 index 00000000000..6d8bb9ec6d9 --- /dev/null +++ b/addons/l10n_in/demo/account_demo.py @@ -0,0 +1,612 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging +import time +from datetime import datetime, timedelta + +from odoo import api, models, Command +from odoo.exceptions import UserError, ValidationError +from odoo.tools.misc import file_open + +_logger = logging.getLogger(__name__) + + +class AccountChartTemplate(models.AbstractModel): + _inherit = "account.chart.template" + + @api.model + def _get_demo_data(self, company=False): + demo_data = {} + if company.account_fiscal_country_id.code == "IN": + if company.state_id: + demo_data = { + 'res.partner.category': self._get_demo_data_res_partner_category(company), + 'res.partner': self._get_demo_data_partner(company), + 'account.move': self._get_demo_data_move(company), + 'res.config.settings': self._get_demo_data_config_settings(company), + 'ir.attachment': self._get_demo_data_attachment(company), + 'mail.message': self._get_demo_data_mail_message(company), + } + else: + _logger.error('Error while loading Indian-Accounting demo data in the company "%s".State is not set in the company.', company.name) + else: + demo_data = super()._get_demo_data(company) + return demo_data + + @api.model + def _get_demo_data_config_settings(self, company=False): + return{ + 'sales_credit_limit':{ + 'account_use_credit_limit': True, + 'account_default_credit_limit': '10000' + } + } + + @api.model + def _get_demo_data_res_partner_category(self, company=False): + return{ + 'res_partner_category_registered': { + 'name': 'Registered', + 'color': 2, + }, + 'res_partner_category_unregistered': { + 'name': 'Unregistered', + 'color': 3, + }, + } + + @api.model + def _get_demo_data_partner(self, company=False): + cid = company.id or self.env.company.id + intra_state_id = company.state_id + inter_state_id = self.env['res.country.state'].search([ + ('id', 'not in', intra_state_id.ids), + ('country_id', '=', intra_state_id.country_id.id) + ], order='name DESC', limit=1) + default_partner_dict = {'city': 'City', 'zip': '000000', 'country_id': 'base.in', 'is_company': True} + return{ + 'res_partner_registered_customer': { + **default_partner_dict, + 'name': 'B2B Customer Inter State', + 'category_id': 'res_partner_category_registered', + 'l10n_in_gst_treatment': 'regular', + 'street': '201, Second Floor, IT Tower 4', + 'street2': 'InfoCity Gate - 1, Infocity', + 'state_id': inter_state_id.id, + 'company_id': cid, + 'vat': '%sAABCT1332L2ZD'%(inter_state_id.l10n_in_tin), + }, + 'res_partner_registered_customer_intra_state': { + **default_partner_dict, + 'name': 'B2B Customer Intra State', + 'category_id': 'res_partner_category_registered', + 'l10n_in_gst_treatment': 'regular', + 'street': 'floor-1, Maddikunta-Ankanpally Village', + 'street2': 'Post box No 2, NH-65', + 'state_id': intra_state_id.id, + 'company_id': cid, + 'vat': '%sAAACM4154G1ZO'%(intra_state_id.l10n_in_tin), + }, + 'res_partner_unregistered_customer':{ + **default_partner_dict, + 'name': 'B2C Customer Inter State', + 'category_id': 'res_partner_category_unregistered', + 'l10n_in_gst_treatment': 'unregistered', + 'street': 'B105, yogeshwar Tower', + 'state_id': inter_state_id.id, + 'company_id': cid, + }, + 'res_partner_unregistered_customer_intra_state':{ + **default_partner_dict, + 'name': 'B2C Customer Intra State', + 'category_id': 'res_partner_category_unregistered', + 'l10n_in_gst_treatment': 'unregistered', + 'street': '80, Sarojini Devi Road', + 'state_id': intra_state_id.id, + 'company_id': cid, + }, + 'res_partner_registered_supplier_1': { + **default_partner_dict, + 'name': 'Supplier', + 'category_id': 'res_partner_category_registered', + 'l10n_in_gst_treatment': 'regular', + 'street': '19, Ground Floor', + 'street2': 'Survey Road,Vadipatti', + 'state_id': inter_state_id.id, + 'company_id': cid, + 'vat': '%sAACCT6304M1DB'%(inter_state_id.l10n_in_tin), + }, + 'res_partner_registered_supplier_2': { + **default_partner_dict, + 'name': 'Odoo In Private Limited', + 'category_id': 'res_partner_category_registered', + 'l10n_in_gst_treatment': 'regular', + 'street': '201, Second Floor, IT Tower 4', + 'street2': 'InfoCity Gate - 1, Infocity', + 'state_id': inter_state_id.id, + 'company_id': cid, + 'vat': '%sAACCT6304M1ZB'%(inter_state_id.l10n_in_tin), + }, + 'res_partner_overseas': { + 'name': 'Supplier Overseas', + 'l10n_in_gst_treatment': 'overseas', + 'street': '142 Street, Rigas building', + 'street2': 'Survey Road,', + 'city': 'City', + 'zip': '000000', + 'state_id': 'base.state_us_5', + 'country_id': 'base.us', + 'is_company': True, + 'company_id': cid, + }, + } + + @api.model + def _get_demo_data_move(self, company=False): + cid = company.id or self.env.company.id + def _get_tax_by_id(tax_id): + tax = self.env.ref('account.%s_%s'%((cid), (tax_id))) + return tax.id + if company.account_fiscal_country_id.code == "IN": + sale_journal = self.env['account.journal'].search( + domain=[ + *self.env['account.journal']._check_company_domain(cid), + ('type', '=', 'sale'), + ], limit=1) + return { + # Demo of B2B (business-to-business) Taxable supplies made to other registered person. + 'demo_invoice_b2b_1': { + 'move_type': 'out_invoice', + 'partner_id': 'res_partner_registered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_8', + 'quantity': 2, + 'price_unit': 40000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_28')])], + }), + Command.create({ + 'product_id': 'product.product_product_9', + 'quantity': 3, + 'price_unit': 400.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_28'), _get_tax_by_id('cess_5_plus_1591_sale')])], + }), + Command.create({ + 'product_id': 'product.product_product_10', + 'quantity': 4, + 'price_unit': 300.0, + 'tax_ids':[Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ], + }, + 'demo_invoice_b2b_2': { + 'move_type': 'out_invoice', + 'partner_id': 'res_partner_registered_customer_intra_state', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_9', + 'quantity': 2, + 'price_unit': 4000.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_5')])], + }), + Command.create({ + 'product_id': 'product.product_product_10', + 'quantity': 3, + 'price_unit': 300.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_5')])], + }), + ], + }, + 'demo_bill_b2b_1': { + 'ref': 'INV/001', + 'move_type': 'in_invoice', + 'partner_id': 'res_partner_registered_supplier_2', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 1, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + Command.create({ + 'product_id': 'product.consu_delivery_03', + 'quantity': 1, + 'price_unit': 2000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + 'demo_bill_b2b_2': { + 'ref': 'INV/002', + 'move_type': 'in_invoice', + 'partner_id': 'res_partner_registered_supplier_2', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 4, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + Command.create({ + 'product_id': 'product.consu_delivery_03', + 'quantity': 3, + 'price_unit': 2000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + 'demo_bill_b2b_3': { + 'ref': 'INV/003', + 'move_type': 'in_invoice', + 'partner_id': 'res_partner_registered_supplier_1', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 2, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + Command.create({ + 'product_id': 'product.consu_delivery_03', + 'quantity': 3, + 'price_unit': 2000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + 'demo_invoice_to_extract': { + 'move_type': 'in_invoice', + 'message_main_attachment_id': 'ir_attachment_in_invoice_1', + }, + 'demo_invoice_service': { + 'ref': 'MYS-91021146', + 'move_type': 'in_invoice', + 'partner_id': 'res_partner_registered_supplier_2', + 'invoice_user_id': False, + 'invoice_date': datetime.now(), + 'invoice_line_ids': [ + Command.create({ + 'name': 'Integrated Managed Infrastructure Service', + 'quantity': 1, + 'price_unit': 69132.78, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ], + 'message_main_attachment_id': 'ir_attachment_in_invoice_2', + }, + # Demo of IMP(Import) of supplies. + 'demo_bill_imp': { + 'ref': 'BOE/123', + 'move_type': 'in_invoice', + 'partner_id': 'res_partner_overseas', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_4', + 'quantity': 30, + 'price_unit': 9000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + # Demo of cdnr(Credit/ Debit Note for registered business). Create credit note for demo b2b bill. + 'demo_bill_cdnr_1': { + 'ref': 'CR/001', + 'move_type': 'in_refund', + 'partner_id': 'res_partner_registered_supplier_2', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now() - timedelta(days=1), + 'l10n_in_gst_treatment': 'regular', + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 1, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + Command.create({ + 'product_id': 'product.consu_delivery_03', + 'quantity': 1, + 'price_unit': 2000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + 'demo_bill_cdnr_2': { + 'ref': '000072', + 'move_type': 'in_refund', + 'partner_id': 'res_partner_registered_supplier_1', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 1, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_purchase_18')])], + }), + ] + }, + # Demo of B2CS (business to consumer small) Taxable supplies made to other unregistered Person and below INR 2.5 lakhs invoice value. + 'demo_invoice_b2cs': { + 'move_type': 'out_invoice', + 'partner_id': 'res_partner_unregistered_customer_intra_state', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'consumer', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_16', + 'quantity': 1, + 'price_unit': 1500.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_18')])], + }), + Command.create({ + 'product_id': 'product.product_product_20', + 'quantity': 1, + 'price_unit': 2300.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_18')])], + }), + Command.create({ + 'product_id': 'product.product_product_22', + 'quantity': 1, + 'price_unit': 2600.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_18')])], + }), + Command.create({ + 'product_id': 'product.product_product_24', + 'quantity': 2, + 'price_unit': 1655.0, + 'tax_ids': [Command.set([_get_tax_by_id('sgst_sale_5')])], + }), + ] + }, + # Demo of B2CL (business to consumer - Large) Taxable supplies made to other unregistered Person and invoice value is more than INR 2.5 lakhs. + 'demo_invoice_b2cl': { + 'move_type': 'out_invoice', + 'partner_id': 'res_partner_unregistered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'consumer', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 3, + 'price_unit': 90000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ] + }, + # Demo of EXP(Export) supplies including supplies to SEZ/SEZ Developer or deemed exports. + 'demo_invoice_exp': { + 'move_type': 'out_invoice', + 'partner_id': 'base.res_partner_3', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'overseas', + 'l10n_in_shipping_bill_number': '999704', + 'l10n_in_shipping_bill_date': time.strftime('%Y-%m-02'), + 'l10n_in_shipping_port_code_id': 'l10n_in.port_code_inixy1', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_4', + 'quantity': 30, + 'price_unit': 8000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ] + }, + # Demo of exempt(Nil Rated, Exempted and Non GST supplies). Set Nill rated and Exempted tax in line. + 'demo_invoice_nill': { + 'move_type': 'out_invoice', + 'partner_id': 'res_partner_registered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_1', + 'quantity': 2, + 'price_unit': 25000.0, + 'tax_ids': [Command.set([_get_tax_by_id('exempt_sale')])], + }), + Command.create({ + 'product_id': 'product.product_product_5', + 'quantity': 1, + 'price_unit': 400.0, + 'tax_ids': [Command.set([_get_tax_by_id('nil_rated_sale')])], + }), + ] + }, + # Demo of cdnr(Credit/ Debit Note for registered person). Create credit note for demo b2b invoice. + 'demo_invoice_cdnr_1': { + 'move_type': 'out_refund', + 'partner_id': 'res_partner_registered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'reversed_entry_id': 'demo_invoice_b2b_1', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.product_product_8', + 'quantity': 2, + 'price_unit': 40000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_28')])], + }), + Command.create({ + 'product_id': 'product.product_product_9', + 'quantity': 3, + 'price_unit': 400.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_28'), _get_tax_by_id('cess_5_plus_1591_sale')])], + }), + Command.create({ + 'product_id': 'product.product_product_10', + 'quantity': 4, + 'price_unit': 300.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ] + }, + 'demo_invoice_cdnr_2': { + 'move_type': 'out_refund', + 'partner_id': 'res_partner_registered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'regular', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 1, + 'price_unit': 1000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + Command.create({ + 'product_id': 'product.consu_delivery_03', + 'quantity': 1, + 'price_unit': 2000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ] + }, + # Demo of cdnr(Credit/ Debit Note for unregistered person). Create credit note for demo b2cl invoice. + 'demo_invoice_cdnur': { + 'move_type': 'out_refund', + 'partner_id': 'res_partner_unregistered_customer', + 'invoice_user_id': 'base.user_demo', + 'invoice_payment_term_id': 'account.account_payment_term_end_following_month', + 'invoice_date': datetime.now(), + 'l10n_in_gst_treatment': 'consumer', + 'reversed_entry_id': 'demo_invoice_b2cl', + 'journal_id': sale_journal.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': 'product.consu_delivery_01', + 'quantity': 3, + 'price_unit': 90000.0, + 'tax_ids': [Command.set([_get_tax_by_id('igst_sale_18')])], + }), + ] + }, + } + else: + return super()._get_demo_data_move(company) + + @api.model + def _get_demo_data_attachment(self, company=False): + if company.account_fiscal_country_id.code == "IN": + return{ + 'ir_attachment_in_invoice_1': { + 'type': 'binary', + 'name': 'in_invoice_demo_1.pdf', + 'res_model': 'account.move', + 'res_id': 'demo_invoice_to_extract', + 'raw': file_open( + 'l10n_in/static/demo/in_invoice_demo_1.pdf', 'rb' + ).read() + }, + 'ir_attachment_in_invoice_2': { + 'type': 'binary', + 'name': 'in_invoice_demo_2.pdf', + 'res_model': 'account.move', + 'res_id': 'demo_invoice_service', + 'raw': file_open( + 'l10n_in/static/demo/in_invoice_demo_2.pdf', 'rb' + ).read() + } + } + else: + return super()._get_demo_data_attachment(company) + + + @api.model + def _get_demo_data_mail_message(self, company=False): + if company.account_fiscal_country_id.code == "IN": + return { + 'mail_message_in_invoice_1': { + 'model': 'account.move', + 'res_id': 'demo_invoice_to_extract', + 'body': 'Vendor Bill attachment', + 'message_type': 'comment', + 'author_id': 'base.partner_demo', + 'attachment_ids': [Command.set([ + 'ir_attachment_in_invoice_1', + ])] + }, + 'mail_message_in_invoice_2': { + 'model': 'account.move', + 'res_id': 'demo_invoice_service', + 'body': 'Vendor Bill attachment', + 'message_type': 'comment', + 'author_id': 'base.partner_demo', + 'attachment_ids': [Command.set([ + 'ir_attachment_in_invoice_2', + ])] + }, + } + else: + return super()._get_demo_data_mail_message(company) + + def _post_load_demo_data(self, company=False): + if company.account_fiscal_country_id.code == "IN": + if company.state_id: + invoices = ( + self.ref('demo_invoice_b2b_1') + + self.ref('demo_invoice_b2b_2') + + self.ref('demo_invoice_b2cs') + + self.ref('demo_invoice_b2cl') + + self.ref('demo_invoice_exp') + + self.ref('demo_invoice_nill') + + self.ref('demo_invoice_cdnr_1') + + self.ref('demo_invoice_cdnr_2') + + self.ref('demo_invoice_cdnur') + + self.ref('demo_bill_b2b_1') + + self.ref('demo_bill_b2b_2') + + self.ref('demo_bill_b2b_3') + + self.ref('demo_bill_imp') + + self.ref('demo_bill_cdnr_1') + + self.ref('demo_bill_cdnr_2') + + self.ref('demo_invoice_service') + ) + for move in invoices: + try: + move.action_post() + except (UserError, ValidationError): + _logger.exception('Error while posting demo data') + else: + return super()._post_load_demo_data(company) diff --git a/addons/l10n_in/demo/account_invoice_demo.xml b/addons/l10n_in/demo/account_invoice_demo.xml deleted file mode 100644 index dbb3ebd4b77..00000000000 --- a/addons/l10n_in/demo/account_invoice_demo.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - out_invoice - - - - - - regular - - - - - diff --git a/addons/l10n_in/demo/demo_company.xml b/addons/l10n_in/demo/demo_company.xml index a0c725186e2..c313001f236 100644 --- a/addons/l10n_in/demo/demo_company.xml +++ b/addons/l10n_in/demo/demo_company.xml @@ -2,7 +2,7 @@ IN Company - 36AABCT1332L011 + 24DUMMY1234AAZA Block no. 401 Street 2 Hyderabad diff --git a/addons/l10n_in/demo/res_partner_demo.xml b/addons/l10n_in/demo/res_partner_demo.xml deleted file mode 100644 index 367a584e6b8..00000000000 --- a/addons/l10n_in/demo/res_partner_demo.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - Registered - - - - Unregistered - - - - Reseller - - - - - Registered Customer Intra State - - 1 - regular - floor-1, Maddikunta-Ankanpally Village - Post box No 2, NH-65 - Sangareddy - 500002 - - - 36AAACM4154G1ZO - - - - - Reseller(E-Commerce) - - 4/001 Ground Floor, 16th Main Rd, - regular - Bengaluru - 560001 - - - 29AJIPA1572E1ZR - - diff --git a/addons/l10n_in/static/demo/in_invoice_demo_1.pdf b/addons/l10n_in/static/demo/in_invoice_demo_1.pdf new file mode 100644 index 00000000000..a170e5a33e5 Binary files /dev/null and b/addons/l10n_in/static/demo/in_invoice_demo_1.pdf differ diff --git a/addons/l10n_in/static/demo/in_invoice_demo_2.pdf b/addons/l10n_in/static/demo/in_invoice_demo_2.pdf new file mode 100644 index 00000000000..2e88b8ea81c Binary files /dev/null and b/addons/l10n_in/static/demo/in_invoice_demo_2.pdf differ diff --git a/addons/l10n_in_edi_ewaybill/__manifest__.py b/addons/l10n_in_edi_ewaybill/__manifest__.py index bf9ea31c794..07ce3134cf2 100755 --- a/addons/l10n_in_edi_ewaybill/__manifest__.py +++ b/addons/l10n_in_edi_ewaybill/__manifest__.py @@ -29,8 +29,6 @@ Step 4: Repeat steps 1,2,3 for all GSTIN you have in odoo. If you have a multi-c ], "demo": [ "demo/demo_company.xml", - "demo/res_partner_demo.xml", - "demo/account_invoice_demo.xml", ], "installable": True, # not auto_install because the company can be related to the service industry diff --git a/addons/l10n_in_edi_ewaybill/demo/__init__.py b/addons/l10n_in_edi_ewaybill/demo/__init__.py index 5514ac3be98..979520bdf51 100644 --- a/addons/l10n_in_edi_ewaybill/demo/__init__.py +++ b/addons/l10n_in_edi_ewaybill/demo/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import chart_template +from . import account_demo diff --git a/addons/l10n_in_edi_ewaybill/demo/account_demo.py b/addons/l10n_in_edi_ewaybill/demo/account_demo.py new file mode 100644 index 00000000000..c2cf7a295d0 --- /dev/null +++ b/addons/l10n_in_edi_ewaybill/demo/account_demo.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging +from odoo import api, models + +_logger = logging.getLogger(__name__) + +class AccountChartTemplate(models.AbstractModel): + _inherit = "account.chart.template" + + def _post_load_demo_data(self, company=False): + if company and company.account_fiscal_country_id.code == 'IN': + self._update_l10n_in_demo_data(company) + return super()._post_load_demo_data(company) + + @api.model + def _update_l10n_in_demo_data(self, company=False): + indian_companies = company or self.env['res.company'].search([('account_fiscal_country_id.code', '=', 'IN')]) + for indian_company in indian_companies: + if indian_company.state_id: + invoices = [ + 'demo_invoice_b2b_1', + 'demo_invoice_b2b_2', + 'demo_invoice_b2cs', + 'demo_invoice_b2cl', + 'demo_invoice_nill', + ] + for xml_id in invoices: + self.ref("account.%s_%s"%(indian_company.id, xml_id)).write({ + 'l10n_in_type_id': self.env.ref("l10n_in_edi_ewaybill.type_tax_invoice_sub_type_supply"), + 'l10n_in_distance': 20, + 'l10n_in_mode': '1', + 'l10n_in_vehicle_no': 'GJ11OD1234', + 'l10n_in_vehicle_type': 'R', + }) + else: + _logger.error('Error while loading Indian-Ewaybill demo data in the company "%s".State is not set in the company.', indian_company.name) diff --git a/addons/l10n_in_edi_ewaybill/demo/account_invoice_demo.xml b/addons/l10n_in_edi_ewaybill/demo/account_invoice_demo.xml deleted file mode 100644 index 2cd3778d47d..00000000000 --- a/addons/l10n_in_edi_ewaybill/demo/account_invoice_demo.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - out_invoice - - - - - regular - - 20 - 1 - GJ11OD1234 - R - - - - diff --git a/addons/l10n_in_edi_ewaybill/demo/chart_template.py b/addons/l10n_in_edi_ewaybill/demo/chart_template.py deleted file mode 100644 index 47f4c707bbb..00000000000 --- a/addons/l10n_in_edi_ewaybill/demo/chart_template.py +++ /dev/null @@ -1,19 +0,0 @@ -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models, api, Command - - -class AccountChartTemplate(models.AbstractModel): - _inherit = 'account.chart.template' - - @api.model - def _get_demo_data(self, company=False): - company = company or self.env.company - """We need to deactivate einvoice here, as we can not send e-invoice and e-waybill in the same demo company""" - if company == self.env.ref('l10n_in_edi_ewaybill.demo_company_in_ewaybill'): - sales_journals = self.env['account.journal'].search([ - *self.env['account.journal']._check_company_domain(company), - ('type', '=', 'sale'), - ]) - sales_journals.write({'edi_format_ids': [Command.unlink(self.env.ref('l10n_in_edi.edi_in_einvoice_json_1_03').id)]}) - return super()._get_demo_data(company) diff --git a/addons/l10n_in_edi_ewaybill/demo/demo_company.xml b/addons/l10n_in_edi_ewaybill/demo/demo_company.xml index 4689f65b222..2029ff2ff94 100755 --- a/addons/l10n_in_edi_ewaybill/demo/demo_company.xml +++ b/addons/l10n_in_edi_ewaybill/demo/demo_company.xml @@ -1,35 +1,9 @@ - - E-Waybill Company - 05AAACH6188F1ZM - 46B 49B, RAIPUR - BHAGWANPUR, ROORKEE - Haridwar - - - 247667 + + iap_odoo + odoo - - E-Waybill Company - - 05AAACH6188F1ZM - abc123@@ - - - - - - - - - - - - - - in - - + diff --git a/addons/l10n_in_edi_ewaybill/demo/res_partner_demo.xml b/addons/l10n_in_edi_ewaybill/demo/res_partner_demo.xml deleted file mode 100755 index c0eec35e0f4..00000000000 --- a/addons/l10n_in_edi_ewaybill/demo/res_partner_demo.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Registered Customer (E-Waybill) - - 1 - regular - 19, Ground Floor - Survey Road - Dehradun - 248001 - - - 05AAACH6605F1Z0 - - -