[FIX] sale: Add misc missing computation triggers

This commit is contained in:
Yannick Tivisse
2021-12-02 12:12:02 +01:00
parent b16b3e32f7
commit 8a6093c612
4 changed files with 9 additions and 5 deletions
+4 -2
View File
@@ -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:
+1 -1
View File
@@ -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()
@@ -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):
@@ -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")