From 36f9bc899c65b9279751f8f60a952f53fb19f4eb Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Tue, 13 Feb 2024 12:54:46 +0530 Subject: [PATCH] [REF] l10n_in: seperate account.py to account_tax.py and remove account_move_line model Since existing model AccountMoveLine and AccountTax where lying under the same file which was bit hard to find, now the AccountTax(account_tax.py) have seperate file and removes the bad code from `account.move.line` which ends up removal of the model from l10n_in Part-of: odoo/odoo#153773 --- addons/l10n_in/models/__init__.py | 2 +- .../models/{account.py => account_tax.py} | 24 +------------------ .../l10n_in/tests/test_invoice_hsn_summary.py | 2 +- 3 files changed, 3 insertions(+), 25 deletions(-) rename addons/l10n_in/models/{account.py => account_tax.py} (55%) diff --git a/addons/l10n_in/models/__init__.py b/addons/l10n_in/models/__init__.py index bdb3566e50f..77b98ef1501 100644 --- a/addons/l10n_in/models/__init__.py +++ b/addons/l10n_in/models/__init__.py @@ -1,6 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import template_in -from . import account +from . import account_tax from . import account_invoice from . import company from . import product_template diff --git a/addons/l10n_in/models/account.py b/addons/l10n_in/models/account_tax.py similarity index 55% rename from addons/l10n_in/models/account.py rename to addons/l10n_in/models/account_tax.py index 225582237f9..e6f1e6de8cf 100644 --- a/addons/l10n_in/models/account.py +++ b/addons/l10n_in/models/account_tax.py @@ -1,26 +1,4 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, fields, models, _ -from odoo.exceptions import ValidationError -from odoo import tools - - -class AccountMoveLine(models.Model): - _inherit = "account.move.line" - - def init(self): - tools.create_index(self._cr, 'account_move_line_move_product_index', self._table, ['move_id', 'product_id']) - - @api.depends('move_id.line_ids', 'move_id.line_ids.tax_line_id', 'move_id.line_ids.debit', 'move_id.line_ids.credit') - def _compute_tax_base_amount(self): - aml = self.filtered(lambda l: l.company_id.account_fiscal_country_id.code == 'IN' and l.tax_line_id and l.product_id) - for move_line in aml: - base_lines = move_line.move_id.line_ids.filtered(lambda line: move_line.tax_line_id in line.tax_ids and move_line.product_id == line.product_id) - move_line.tax_base_amount = abs(sum(base_lines.mapped('balance'))) - remaining_aml = self - aml - if remaining_aml: - return super(AccountMoveLine, remaining_aml)._compute_tax_base_amount() +from odoo import api, fields, models class AccountTax(models.Model): diff --git a/addons/l10n_in/tests/test_invoice_hsn_summary.py b/addons/l10n_in/tests/test_invoice_hsn_summary.py index c8122504fe7..fb3f4978317 100644 --- a/addons/l10n_in/tests/test_invoice_hsn_summary.py +++ b/addons/l10n_in/tests/test_invoice_hsn_summary.py @@ -621,4 +621,4 @@ class TestInvoiceHSNsummary(AccountTestInvoicingCommon): 'tax_amount_cess': 0.0, }, ], - }) + }) \ No newline at end of file