Targeted Qt
This commit is contained in:
@@ -2916,7 +2916,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
Decimal('10'))
|
||||
|
||||
def test_purchase_line_tolerance_uses_physical_lots_when_present(self):
|
||||
'purchase line tolerance ignores open lot.qt when physical lots exist'
|
||||
'purchase line tolerance uses the editable targeted quantity'
|
||||
unit = Mock()
|
||||
virtual = Mock(id=10, lot_type='virtual')
|
||||
physical = Mock(lot_type='physic')
|
||||
@@ -2925,6 +2925,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
line.unit = unit
|
||||
line.quantity_theorical = Decimal('100')
|
||||
line.quantity = Decimal('100')
|
||||
line.targeted_qt = Decimal('105')
|
||||
line.lots = [virtual, physical]
|
||||
line.inherit_tol = False
|
||||
line.tol_min = Decimal('5')
|
||||
@@ -2942,13 +2943,14 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
lot_qt_model.search.assert_not_called()
|
||||
|
||||
def test_sale_line_tolerance_uses_open_lot_qt_without_physical_lots(self):
|
||||
'sale line tolerance uses absolute lot.qt when no physical lot exists'
|
||||
'sale line tolerance uses the editable targeted quantity'
|
||||
unit = Mock()
|
||||
virtual = Mock(id=20, lot_type='virtual')
|
||||
line = sale_module.SaleLine()
|
||||
line.unit = unit
|
||||
line.quantity_theorical = Decimal('100')
|
||||
line.quantity = Decimal('100')
|
||||
line.targeted_qt = Decimal('95')
|
||||
line.lots = [virtual]
|
||||
line.inherit_tol = False
|
||||
line.tol_min = Decimal('5')
|
||||
@@ -2971,6 +2973,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
line = purchase_module.Line()
|
||||
line.quantity_theorical = Decimal('100')
|
||||
line.quantity = Decimal('100')
|
||||
line.targeted_qt = Decimal('111')
|
||||
line.lots = [physical]
|
||||
line.inherit_tol = False
|
||||
line.tol_min = Decimal('5')
|
||||
@@ -2987,6 +2990,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
line.unit = unit
|
||||
line.quantity_theorical = Decimal('100')
|
||||
line.quantity = Decimal('100')
|
||||
line.targeted_qt = Decimal('94')
|
||||
line.lots = [virtual]
|
||||
line.inherit_tol = False
|
||||
line.tol_min = Decimal('5')
|
||||
@@ -3001,6 +3005,22 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
with self.assertRaises(UserError):
|
||||
line.check_targeted_qt_tolerance()
|
||||
|
||||
def test_purchase_line_initial_targeted_qt_defaults_to_contract_quantity(self):
|
||||
'purchase line targeted quantity defaults to contractual quantity'
|
||||
values = {'quantity_theorical': Decimal('100')}
|
||||
|
||||
purchase_module.Line._set_initial_quantity_values(values)
|
||||
|
||||
self.assertEqual(values['targeted_qt'], Decimal('100.00000'))
|
||||
|
||||
def test_sale_line_initial_targeted_qt_defaults_to_contract_quantity(self):
|
||||
'sale line targeted quantity defaults to contractual quantity'
|
||||
values = {'quantity_theorical': Decimal('100')}
|
||||
|
||||
sale_module.SaleLine._set_initial_quantity_values(values)
|
||||
|
||||
self.assertEqual(values['targeted_qt'], Decimal('100.00000'))
|
||||
|
||||
def test_lot_context_group_defaults_to_all(self):
|
||||
'lots management opens without grouping by physical lot'
|
||||
self.assertEqual(lot_module.LotContext.default_group(), 'all')
|
||||
|
||||
Reference in New Issue
Block a user