pricing manuel
This commit is contained in:
@@ -290,6 +290,38 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(
|
||||
purchase_pricing.get_eod_price_purchase(), Decimal('106.0000'))
|
||||
|
||||
def test_pricing_sync_manual_last_uses_greatest_date_per_component_group(self):
|
||||
'pricing rows keep one last by line/component, chosen by greatest pricing date'
|
||||
Pricing = Pool().get('pricing.pricing')
|
||||
|
||||
sale_line = Mock(id=10)
|
||||
component = Mock(id=33)
|
||||
first = Mock(
|
||||
id=1,
|
||||
price_component=component,
|
||||
sale_line=sale_line,
|
||||
line=None,
|
||||
pricing_date=datetime.date(2026, 4, 10),
|
||||
last=True,
|
||||
)
|
||||
second = Mock(
|
||||
id=2,
|
||||
price_component=component,
|
||||
sale_line=sale_line,
|
||||
line=None,
|
||||
pricing_date=datetime.date(2026, 4, 9),
|
||||
last=False,
|
||||
)
|
||||
|
||||
with patch.object(Pricing, 'search', return_value=[second, first]), patch(
|
||||
'trytond.modules.purchase_trade.pricing.super') as super_mock:
|
||||
Pricing._sync_manual_last([first, second])
|
||||
|
||||
self.assertEqual(super_mock.return_value.write.call_args_list[0].args[0], [second])
|
||||
self.assertEqual(super_mock.return_value.write.call_args_list[0].args[1], {'last': False})
|
||||
self.assertEqual(super_mock.return_value.write.call_args_list[1].args[0], [first])
|
||||
self.assertEqual(super_mock.return_value.write.call_args_list[1].args[1], {'last': True})
|
||||
|
||||
def test_sale_and_purchase_trader_operator_domains_use_explicit_categories(self):
|
||||
'sale and purchase trader/operator fields are filtered by TRADER/OPERATOR categories'
|
||||
Sale = Pool().get('sale.sale')
|
||||
|
||||
Reference in New Issue
Block a user