diff --git a/addons/purchase/models/purchase_order_line.py b/addons/purchase/models/purchase_order_line.py index 19fccdfbd6f..0bbaffe63d5 100644 --- a/addons/purchase/models/purchase_order_line.py +++ b/addons/purchase/models/purchase_order_line.py @@ -30,7 +30,7 @@ class PurchaseOrderLine(models.Model): compute='_compute_price_unit_and_date_planned_and_name', digits='Discount', store=True, readonly=False) - taxes_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)]) + taxes_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)], context={'active_test': False}) product_uom = fields.Many2one('uom.uom', string='Unit of Measure', domain="[('category_id', '=', product_uom_category_id)]") product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id') product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, index='btree_not_null') diff --git a/addons/purchase/tests/test_purchase_tax_totals.py b/addons/purchase/tests/test_purchase_tax_totals.py index 2b0529cc5a6..95afd6a5182 100644 --- a/addons/purchase/tests/test_purchase_tax_totals.py +++ b/addons/purchase/tests/test_purchase_tax_totals.py @@ -60,3 +60,26 @@ class PurchaseTestTaxTotals(TestTaxTotals): }) tax_purchase.invalidate_model(fnames=['is_used']) self.assertTrue(tax_purchase.is_used) + + def test_archived_tax_totals(self): + tax_10 = self.env['account.tax'].create({ + 'name': "tax_10", + 'amount_type': 'percent', + 'amount': 10.0, + 'tax_group_id': self.tax_group1.id, + }) + + po = self._create_document_for_tax_totals_test([ + (100.0, tax_10), + ]) + po.button_confirm() + po.order_line.qty_received = 1 + po.action_create_invoice() + + invoice = po.invoice_ids + invoice.invoice_date = '2020-01-01' + invoice.action_post() + + old_ammount = po.amount_total + tax_10.active = False + self.assertEqual(po.amount_total, old_ammount)