From to + pricing component
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 Eval
|
||||
from trytond.pyson import Bool, Eval, If
|
||||
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,11 @@ 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, [
|
||||
'OR',
|
||||
('line', '=', Eval('line', -1)),
|
||||
('sale_line', '=', Eval('sale_line', -1)),
|
||||
])
|
||||
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)))])
|
||||
|
||||
def test_pricing_component_must_belong_to_pricing_owner(self):
|
||||
'pricing rows reject components from another purchase or sale line'
|
||||
@@ -579,6 +579,17 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertFalse(PurchaseLine._has_invalid_delivery_period(valid))
|
||||
self.assertFalse(SaleLine._has_invalid_delivery_period(valid))
|
||||
|
||||
purchase_line = PurchaseLine()
|
||||
purchase_line.from_del = invalid.from_del
|
||||
purchase_line.to_del = invalid.to_del
|
||||
sale_line = SaleLine()
|
||||
sale_line.from_del = invalid.from_del
|
||||
sale_line.to_del = invalid.to_del
|
||||
with self.assertRaises(UserError):
|
||||
purchase_line.on_change_from_del()
|
||||
with self.assertRaises(UserError):
|
||||
sale_line.on_change_to_del()
|
||||
|
||||
def test_pricing_eod_uses_weighted_average_for_manual_rows(self):
|
||||
'manual pricing eod uses the weighted average of fixed and unfixed legs'
|
||||
Pricing = Pool().get('pricing.pricing')
|
||||
|
||||
Reference in New Issue
Block a user