parent
505180b287
commit
10f165996e
11
load.py
11
load.py
|
@ -112,6 +112,13 @@ class LoadOrder:
|
|||
res.ul_quantity = len(grouped_items)
|
||||
return res
|
||||
|
||||
def _get_shipment_sale(self, sale):
|
||||
res = super(LoadOrder, self)._get_shipment_sale(sale)
|
||||
res.start_date = self.start_date
|
||||
res.on_change_start_date()
|
||||
res.end_date = self.end_date
|
||||
return res
|
||||
|
||||
def _get_shipment_moves(self, sale_line, grouped_items):
|
||||
pool = Pool()
|
||||
Move = pool.get('stock.move')
|
||||
|
@ -121,7 +128,7 @@ class LoadOrder:
|
|||
for item in grouped_items:
|
||||
new_moves = item._get_new_moves({'from_location': sale_line.from_location.id,
|
||||
'to_location': sale_line.to_location.id,
|
||||
'planned_date': sale_line.delivery_date})
|
||||
'date_time_': self.end_date})
|
||||
move, = [m for m in new_moves if m.product == item.product]
|
||||
move.origin = sale_line
|
||||
moves.append(move)
|
||||
|
@ -165,7 +172,7 @@ class LoadOrder:
|
|||
product=move.product,
|
||||
uom=move.uom,
|
||||
quantity=move.quantity,
|
||||
planned_date=move.planned_date,
|
||||
date_time_=self.start_date,
|
||||
company=move.company,
|
||||
currency=move.currency,
|
||||
unit_price=move.unit_price,
|
||||
|
|
|
@ -152,6 +152,7 @@ Create load order::
|
|||
|
||||
>>> Order = Model.get('carrier.load.order')
|
||||
>>> order = Order(load=load)
|
||||
>>> order.start_date = datetime.datetime.now() - relativedelta(minutes=20)
|
||||
>>> order.state
|
||||
'draft'
|
||||
>>> order.ul_origin_restrict
|
||||
|
@ -171,7 +172,8 @@ Create load order::
|
|||
Create unit load::
|
||||
|
||||
>>> Unitload = Model.get('stock.unit_load')
|
||||
>>> ul = create_unit_load(config=config, do_state=False)
|
||||
>>> ul = create_unit_load(config=config, do_state=False,
|
||||
... default_values={'start_date': datetime.datetime.now() + relativedelta(days=-1)})
|
||||
>>> template = ul.product.template
|
||||
>>> template.salable = True
|
||||
>>> template.account_expense = expense
|
||||
|
@ -235,6 +237,7 @@ Check UL loading restrictions::
|
|||
Traceback (most recent call last):
|
||||
...
|
||||
UserError: ('UserError', (u'UL "1" must be in Done state.', ''))
|
||||
>>> ul.click('assign')
|
||||
>>> ul.click('do')
|
||||
>>> start_load.execute('load_') # doctest:
|
||||
Traceback (most recent call last):
|
||||
|
@ -269,11 +272,13 @@ Add an invalid UL::
|
|||
|
||||
>>> Location = Model.get('stock.location')
|
||||
>>> lost_found, = Location.find([('type', '=', 'lost_found')], limit=1)
|
||||
>>> ul2 = create_unit_load(do_state=False)
|
||||
>>> ul2 = create_unit_load(do_state=False,
|
||||
... default_values={'start_date': datetime.datetime.now() + relativedelta(days=-1)})
|
||||
>>> ul2.save()
|
||||
>>> ul2.click('do')
|
||||
>>> move_ul = Wizard('stock.unit_load.do_move', [ul2])
|
||||
>>> move_ul.form.location = lost_found
|
||||
>>> move_ul.form.date = ul2.end_date + relativedelta(minutes=30)
|
||||
>>> move_ul.execute('move_')
|
||||
>>> ul2.click('do')
|
||||
>>> start_load.form.ul_code = ul2.code
|
||||
|
@ -283,6 +288,7 @@ Add an invalid UL::
|
|||
UserError: ('UserError', (u'UL "2" must be in a storage location.', ''))
|
||||
>>> move_ul = Wizard('stock.unit_load.do_move', [ul2])
|
||||
>>> move_ul.form.location = ul.location
|
||||
>>> move_ul.form.date = ul2.end_date + relativedelta(minutes=45)
|
||||
>>> move_ul.execute('move_')
|
||||
>>> ul2.reload()
|
||||
>>> ul2.click('do')
|
||||
|
@ -346,13 +352,18 @@ Check sale::
|
|||
True
|
||||
>>> len(order.sale.shipments)
|
||||
1
|
||||
>>> len(order.sale.shipments[0].outgoing_moves)
|
||||
1
|
||||
>>> order.sale.shipments[0].outgoing_moves[0].unit_load.id == ul.id
|
||||
>>> shipment, = order.sale.shipments
|
||||
>>> shipment.start_date == order.start_date
|
||||
True
|
||||
>>> len(order.sale.shipments[0].inventory_moves)
|
||||
>>> shipment.end_date == order.end_date
|
||||
True
|
||||
>>> len(shipment.outgoing_moves)
|
||||
1
|
||||
>>> order.sale.shipments[0].inventory_moves[0].unit_load.id == ul.id
|
||||
>>> shipment.outgoing_moves[0].unit_load.id == ul.id
|
||||
True
|
||||
>>> len(shipment.inventory_moves)
|
||||
1
|
||||
>>> shipment.inventory_moves[0].unit_load.id == ul.id
|
||||
True
|
||||
>>> len(order.inventory_moves)
|
||||
1
|
||||
|
@ -360,6 +371,8 @@ Check sale::
|
|||
u'Plastic Case 30x30'
|
||||
>>> order.inventory_moves[0].quantity
|
||||
2.0
|
||||
>>> order.inventory_moves[0].date_time_ == order.start_date
|
||||
True
|
||||
>>> len(order.outgoing_moves)
|
||||
1
|
||||
>>> order.outgoing_moves[0].product.rec_name
|
||||
|
|
Loading…
Reference in New Issue