[FIX] account: prevent wrong type tax on move
- Create an account of type current asset - Add him a Sales Tax and a Purchase Tax - Create invoice - Add a line - Remove the taxes from this line - Change the account to the one you created => A purchase tax is applied to the line. It should not happen, so we prevent it. closes odoo/odoo#117539 X-original-commit: 85d89a986b6adcf9d0ac0ce57599d4b2678b59a3 Signed-off-by: Quentin De Paoli <qdp@odoo.com> Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
This commit is contained in:
@@ -849,20 +849,16 @@ class AccountMoveLine(models.Model):
|
||||
# Out invoice.
|
||||
if self.product_id.taxes_id:
|
||||
tax_ids = self.product_id.taxes_id.filtered(lambda tax: tax.company_id == self.move_id.company_id)
|
||||
elif self.account_id.tax_ids:
|
||||
tax_ids = self.account_id.tax_ids
|
||||
else:
|
||||
tax_ids = self.env['account.tax']
|
||||
tax_ids = self.account_id.tax_ids.filtered(lambda tax: tax.type_tax_use == 'sale')
|
||||
if not tax_ids and self.display_type == 'product':
|
||||
tax_ids = self.move_id.company_id.account_sale_tax_id
|
||||
elif self.move_id.is_purchase_document(include_receipts=True):
|
||||
# In invoice.
|
||||
if self.product_id.supplier_taxes_id:
|
||||
tax_ids = self.product_id.supplier_taxes_id.filtered(lambda tax: tax.company_id == self.move_id.company_id)
|
||||
elif self.account_id.tax_ids:
|
||||
tax_ids = self.account_id.tax_ids
|
||||
else:
|
||||
tax_ids = self.env['account.tax']
|
||||
tax_ids = self.account_id.tax_ids.filtered(lambda tax: tax.type_tax_use == 'purchase')
|
||||
if not tax_ids and self.display_type == 'product':
|
||||
tax_ids = self.move_id.company_id.account_purchase_tax_id
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user