From 8a6093c612cfd40af476f5f6c70bc0d897efad90 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 8 Nov 2021 10:05:25 +0100 Subject: [PATCH] [FIX] sale: Add misc missing computation triggers --- addons/sale/models/sale_order_line.py | 6 ++++-- addons/sale_coupon/models/sale_order.py | 2 +- .../tests/test_sale_product_configurator_ui.py | 2 ++ addons/sale_timesheet/tests/test_project_billing.py | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/sale/models/sale_order_line.py b/addons/sale/models/sale_order_line.py index 7ef61f31538..3876473c526 100644 --- a/addons/sale/models/sale_order_line.py +++ b/addons/sale/models/sale_order_line.py @@ -134,7 +134,7 @@ class SaleOrderLine(models.Model): for line in self: line.price_reduce_taxexcl = line.price_subtotal / line.product_uom_qty if line.product_uom_qty else 0.0 - @api.depends('order_id.fiscal_position_id') + @api.depends('order_id.fiscal_position_id', 'tax_id.price_include') def _compute_tax_id(self): for line in self: line = line.with_company(line.company_id) @@ -666,7 +666,9 @@ class SaleOrderLine(models.Model): } } - @api.depends('product_uom', 'product_uom_qty') + @api.depends( + 'product_uom', 'product_uom_qty', 'product_id', + 'order_id.partner_id') def _compute_price_unit(self): for line in self: if not line.product_uom or not line.product_id: diff --git a/addons/sale_coupon/models/sale_order.py b/addons/sale_coupon/models/sale_order.py index 0ab92f0385a..4d10d67889c 100644 --- a/addons/sale_coupon/models/sale_order.py +++ b/addons/sale_coupon/models/sale_order.py @@ -501,7 +501,7 @@ class SaleOrderLine(models.Model): related_program_lines |= line.order_id.order_line.filtered(lambda l: l.product_id.id == related_program.discount_line_product_id.id) - line return super(SaleOrderLine, self | related_program_lines).unlink() - @api.depends('order_id.fiscal_position_id') + @api.depends('order_id.fiscal_position_id', 'tax_id.price_include', 'product_id.taxes_id.price_include') def _compute_tax_id(self): reward_lines = self.filtered('is_reward_line') super(SaleOrderLine, self - reward_lines)._compute_tax_id() diff --git a/addons/sale_product_configurator/tests/test_sale_product_configurator_ui.py b/addons/sale_product_configurator/tests/test_sale_product_configurator_ui.py index 95ab4df737a..0e3ed37f991 100644 --- a/addons/sale_product_configurator/tests/test_sale_product_configurator_ui.py +++ b/addons/sale_product_configurator/tests/test_sale_product_configurator_ui.py @@ -148,6 +148,8 @@ class TestUi(odoo.tests.HttpCase, TestProductConfiguratorCommon): # Remove tax from Conference Chair and Chair floor protection self.product_product_conf_chair.taxes_id = None self.product_product_conf_chair_floor_protect.taxes_id = None + # YTI FIXME: This tour requires sale_management, as the Sale + # root menu item is clicked self.start_tour("/web", 'sale_product_configurator_pricelist_tour', login="admin") def test_06_product_configurator_optional_products(self): diff --git a/addons/sale_timesheet/tests/test_project_billing.py b/addons/sale_timesheet/tests/test_project_billing.py index 3cd6bcc949c..e59e7d7ffdd 100644 --- a/addons/sale_timesheet/tests/test_project_billing.py +++ b/addons/sale_timesheet/tests/test_project_billing.py @@ -5,7 +5,7 @@ from odoo.fields import Command from odoo.tests import tagged from odoo.tests.common import Form -@tagged('post_install', '-at_install') +@tagged('post_install', '-at_install', 'project_billing') class TestProjectBilling(TestCommonSaleTimesheet): """ This test suite provide checks for miscellaneous small things. """ @@ -230,7 +230,7 @@ class TestProjectBilling(TestCommonSaleTimesheet): self.assertFalse(line1.project_id, "Sale line 1 should be linked to the 'non billable' project") self.assertEqual(line2.project_id, self.project_non_billable, "Sale line 3 should be linked to the 'non billable' project") - self.assertEqual(line1.price_unit, 15, "The unit price of SOL 1 should be 15") + self.assertEqual(line1.price_unit, 13, "The unit price of SOL 1 should be 15") self.assertEqual(line1.product_uom_qty, 3, "The ordered qty of SOL 1 should be 3") self.assertEqual(line2.product_uom_qty, 2, "The ordered qty of SOL 2 should be 2")