details: https://code.tryton.org/tryton/commit/b9cffb6b315f
branch: default
user: Cédric Krier <[email protected]>
date: Tue Feb 10 11:55:23 2026 +0100
description:
Use customer shipment to create outgoing move for lot trace test
scenario
diffstat:
modules/stock_lot/tests/scenario_stock_lot_trace.rst | 21 +++++++++++++++++--
1 files changed, 18 insertions(+), 3 deletions(-)
diffs (54 lines):
diff -r 5555b9af7f90 -r b9cffb6b315f
modules/stock_lot/tests/scenario_stock_lot_trace.rst
--- a/modules/stock_lot/tests/scenario_stock_lot_trace.rst Tue Feb 10
17:08:34 2026 +0100
+++ b/modules/stock_lot/tests/scenario_stock_lot_trace.rst Tue Feb 10
11:55:23 2026 +0100
@@ -19,9 +19,16 @@
>>> Lot = Model.get('stock.lot')
>>> LotTrace = Model.get('stock.lot.trace')
>>> Move = Model.get('stock.move')
+ >>> Party = Model.get('party.party')
>>> ProductTemplate = Model.get('product.template')
+ >>> ShipmentOut = Model.get('stock.shipment.out')
>>> UoM = Model.get('product.uom')
+Create customer::
+
+ >>> customer = Party(name="Customer")
+ >>> customer.save()
+
Create product::
>>> unit, = UoM.find([('name', '=', "Unit")])
@@ -42,6 +49,9 @@
>>> supplier_loc, = Location.find([('code', '=', 'SUP')])
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> customer_loc, = Location.find([('code', '=', 'CUS')])
+ >>> warehouse, = Location.find([('type', '=', 'warehouse')])
+ >>> warehouse.output_location = storage_loc
+ >>> warehouse.save()
Make some moves::
@@ -55,15 +65,20 @@
>>> move_in.state
'done'
- >>> move_out = Move(product=product, lot=lot)
+ >>> shipment_out = ShipmentOut(customer=customer)
+ >>> move_out = shipment_out.outgoing_moves.new(product=product, lot=lot)
>>> move_out.quantity = 2
>>> move_out.from_location = storage_loc
>>> move_out.to_location = customer_loc
>>> move_out.currency = get_currency()
>>> move_out.unit_price = Decimal('0')
- >>> move_out.click('do')
- >>> move_out.state
+ >>> shipment_out.click('wait')
+ >>> shipment_out.click('assign_force')
+ >>> shipment_out.click('pack')
+ >>> shipment_out.click('do')
+ >>> shipment_out.state
'done'
+ >>> move_out, = shipment_out.outgoing_moves
Check lot traces::