[FIX] delivery: propagate additional fields in chained pickings
closes #367
This commit is contained in:
parent
548c8e6675
commit
ac117ac220
|
@ -41,7 +41,9 @@ invoices from picking, OpenERP is able to add and compute the shipping line.
|
|||
'delivery_data.xml'
|
||||
],
|
||||
'demo': ['delivery_demo.xml'],
|
||||
'test': ['test/delivery_cost.yml'],
|
||||
'test': ['test/delivery_cost.yml',
|
||||
'test/delivery_chained_pickings.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'images': ['images/1_delivery_method.jpeg','images/2_delivery_pricelist.jpeg'],
|
||||
|
|
|
@ -167,6 +167,17 @@ class stock_move(osv.osv):
|
|||
}
|
||||
return res
|
||||
|
||||
def _prepare_chained_picking(self, cr, uid, picking_name, picking, picking_type, moves_todo, context=None):
|
||||
values = super(stock_move, self)._prepare_chained_picking(cr, uid, picking_name, picking, picking_type, moves_todo, context=context)
|
||||
if picking.carrier_id:
|
||||
values['carrier_id'] = picking.carrier_id.id
|
||||
values['volume'] = picking.volume
|
||||
values['weight'] = picking.weight
|
||||
values['weight_net'] = picking.weight_net
|
||||
values['carrier_tracking_ref'] = picking.carrier_tracking_ref
|
||||
values['number_of_packages'] = picking.number_of_packages
|
||||
return values
|
||||
|
||||
_columns = {
|
||||
'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
|
||||
store={
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
-
|
||||
I setup product and locations
|
||||
-
|
||||
!record {model: stock.location, id: dest_chained_location}:
|
||||
name: DestChainedLocation
|
||||
usage: internal
|
||||
-
|
||||
!record {model: stock.location, id: source_chained_location}:
|
||||
name: Source Chained Location
|
||||
chained_auto_packing: auto
|
||||
chained_location_type: fixed
|
||||
usage: internal
|
||||
chained_location_id: dest_chained_location
|
||||
-
|
||||
I create a picking to location_convenience_shop, which is chained with location_refrigerator
|
||||
-
|
||||
!record {model: stock.picking, id: shipment_with_delivery}:
|
||||
type: internal
|
||||
carrier_id: delivery.delivery_carrier
|
||||
volume: 42
|
||||
carrier_tracking_ref: FDX123
|
||||
number_of_packages: 7
|
||||
-
|
||||
I add a move in the picking
|
||||
-
|
||||
!record {model: stock.move, id: icecream_move}:
|
||||
picking_id: shipment_with_delivery
|
||||
product_id: product_product_delivery
|
||||
product_uom: product.product_uom_kgm
|
||||
product_qty: 130.0
|
||||
location_id: stock.stock_location_suppliers
|
||||
location_dest_id: source_chained_location
|
||||
-
|
||||
I confirm the picking
|
||||
-
|
||||
!workflow {model: stock.picking, action: button_confirm, ref: shipment_with_delivery}
|
||||
-
|
||||
I check that the delivery fields have been propagated to the chained picking
|
||||
-
|
||||
!python {model: stock.move}: |
|
||||
original_move = self.browse(cr, uid, ref('icecream_move'), context=context)
|
||||
original_picking = original_move.picking_id
|
||||
chained_move = original_move.move_dest_id
|
||||
chained_picking = chained_move.picking_id
|
||||
assert chained_picking.carrier_tracking_ref == original_picking.carrier_tracking_ref, 'no propagation of carrier_tracking_ref'
|
||||
assert chained_picking.carrier_id == original_picking.carrier_id, 'no propagation of carrier_id'
|
||||
assert chained_picking.volume == original_picking.volume, 'no propagation of volume'
|
||||
assert chained_picking.weight == original_picking.weight, 'no propagation of weight'
|
||||
assert chained_picking.weight_net == original_picking.weight_net, 'no propagation of weight'
|
||||
|
Loading…
Reference in New Issue