Price component filter domain & from to line/sale line
This commit is contained in:
@@ -6,7 +6,7 @@ from decimal import Decimal
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Bool, Eval, If
|
||||
from trytond.pyson import Eval
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.modules.purchase_trade import valuation as valuation_module
|
||||
@@ -528,11 +528,9 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
'pricing component choices are limited to the purchase or sale line'
|
||||
Pricing = Pool().get('pricing.pricing')
|
||||
|
||||
self.assertEqual(Pricing.price_component.domain, [If(Bool(Eval('line')),
|
||||
('line', '=', Eval('line')),
|
||||
If(Bool(Eval('sale_line')),
|
||||
('sale_line', '=', Eval('sale_line')),
|
||||
('id', '=', -1)))])
|
||||
self.assertEqual(Pricing.price_component.domain, [
|
||||
('id', 'in', Eval('available_components', [])),
|
||||
])
|
||||
|
||||
def test_pricing_component_must_belong_to_pricing_owner(self):
|
||||
'pricing rows reject components from another purchase or sale line'
|
||||
@@ -589,6 +587,14 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
purchase_line.on_change_from_del()
|
||||
with self.assertRaises(UserError):
|
||||
sale_line.on_change_to_del()
|
||||
with self.assertRaises(UserError):
|
||||
PurchaseLine._check_delivery_period_values([valid], {
|
||||
'from_del': invalid.from_del,
|
||||
})
|
||||
with self.assertRaises(UserError):
|
||||
SaleLine._check_delivery_period_values([valid], {
|
||||
'to_del': datetime.date(2026, 3, 31),
|
||||
})
|
||||
|
||||
def test_pricing_eod_uses_weighted_average_for_manual_rows(self):
|
||||
'manual pricing eod uses the weighted average of fixed and unfixed legs'
|
||||
|
||||
Reference in New Issue
Block a user