Duplicate custom
This commit is contained in:
@@ -151,6 +151,8 @@ class TradeCustomDuplicate(Wizard):
|
||||
line.quantity_theorical = options.quantity
|
||||
line.unit_price = options.unit_price
|
||||
line.price_type = options.price_type
|
||||
if hasattr(line, 'finished'):
|
||||
line.finished = False
|
||||
if hasattr(line, 'currency'):
|
||||
line.currency = options.currency
|
||||
if options.clear_fees and hasattr(line, 'fees'):
|
||||
|
||||
@@ -6054,6 +6054,35 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertIsNone(
|
||||
ContractFactory._get_shipment_origin(ContractsStartMock()))
|
||||
|
||||
def test_custom_duplicate_resets_finished_line(self):
|
||||
'custom duplicate keeps duplicated lots visible in lots management'
|
||||
line = Mock(
|
||||
product=Mock(),
|
||||
quantity=None,
|
||||
quantity_theorical=None,
|
||||
unit_price=None,
|
||||
price_type=None,
|
||||
finished=True,
|
||||
fees=[],
|
||||
price_components=[],
|
||||
)
|
||||
record = Mock(lines=[line])
|
||||
options = Mock(
|
||||
quantity=Decimal('100'),
|
||||
unit_price=Decimal('25'),
|
||||
price_type='priced',
|
||||
currency=Mock(),
|
||||
clear_fees=False,
|
||||
clear_pricing_components=False,
|
||||
)
|
||||
line.id = 1
|
||||
|
||||
duplicate_module.TradeCustomDuplicate._apply_line_options(
|
||||
record, options)
|
||||
|
||||
self.assertFalse(line.finished)
|
||||
line.save.assert_called_once()
|
||||
|
||||
def test_custom_duplicate_creates_purchase_open_virtual_lot(self):
|
||||
'custom duplicate creates the purchase opening lot.qt explicitly'
|
||||
saved_lots = []
|
||||
|
||||
Reference in New Issue
Block a user