[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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
@@ -621,4 +621,4 @@ class TestInvoiceHSNsummary(AccountTestInvoicingCommon):
|
||||
'tax_amount_cess': 0.0,
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user