[FIX] purchase: always display inactive taxes on purchase order
Steps to reproduce: - Create a PO with a tax - Confirm PO and bill it - Deactivate tax Issue: Tax is shown on bill but not on PO Solution: Make sure that we display tax even if inactive. opw-3631087 closes odoo/odoo#148778 X-original-commit: 4e424750eccff168c3cbb1a3f8411b35905717f3 Signed-off-by: Adrien Widart (awt) <awt@odoo.com> Signed-off-by: Mattis Megevand (mmeg) <mmeg@odoo.com>
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user