Merge lp:~camptocamp/openobject-addons/6.1-fix-1025703_delivery_chained_pickings-AFE into lp:openobject-addons/6.1

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/6.1-fix-1025703_delivery_chained_pickings-AFE
Merge into: lp:openobject-addons/6.1
Diff against target: 84 lines (+50/-1)
3 files modified
delivery/__openerp__.py (+1/-0)
delivery/stock.py (+12/-1)
delivery/test/delivery_chained_pickings.yml (+37/-0)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/6.1-fix-1025703_delivery_chained_pickings-AFE
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp (community) Approve
OpenERP R&D Addons Team 2 Pending
OpenERP Core Team Pending
Review via email: mp+171252@code.launchpad.net

Description of the change

propagate delivery-specific fields on chained moves

add a test for this.

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

tests are green on runbot

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

l33-37 Just about coding style, a dict update of values wouldn't be cleaner?

Otherwise LGTM

review: Approve

Unmerged revisions

7232. By Alexandre Fayolle - camptocamp

[FIX] delivery: propagate additional fields in chained pickings

7231. By Alexandre Fayolle - camptocamp

[TEST] add test illustrating the issue

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'delivery/__openerp__.py'
--- delivery/__openerp__.py 2012-01-31 13:36:57 +0000
+++ delivery/__openerp__.py 2013-06-25 09:37:33 +0000
@@ -46,6 +46,7 @@
46 'demo_xml': ['delivery_demo.xml'],46 'demo_xml': ['delivery_demo.xml'],
47 'test': [47 'test': [
48 'test/delivery_cost.yml',48 'test/delivery_cost.yml',
49 'test/delivery_chained_pickings.yml',
49 ],50 ],
50 'installable': True,51 'installable': True,
51 'auto_install': False,52 'auto_install': False,
5253
=== modified file 'delivery/stock.py'
--- delivery/stock.py 2011-12-21 18:11:49 +0000
+++ delivery/stock.py 2013-06-25 09:37:33 +0000
@@ -75,7 +75,7 @@
75 :param browse_record picking: the stock picking being invoiced75 :param browse_record picking: the stock picking being invoiced
76 :param browse_record invoice: the stock picking's invoice76 :param browse_record invoice: the stock picking's invoice
77 :return: dict containing the values to create the invoice line,77 :return: dict containing the values to create the invoice line,
78 or None to create nothing78 or None to create nothing
79 """79 """
80 carrier_obj = self.pool.get('delivery.carrier')80 carrier_obj = self.pool.get('delivery.carrier')
81 grid_obj = self.pool.get('delivery.grid')81 grid_obj = self.pool.get('delivery.grid')
@@ -160,6 +160,17 @@
160 }160 }
161 return res161 return res
162162
163 def _prepare_chained_picking(self, cr, uid, picking_name, picking, picking_type, moves_todo, context=None):
164 values = super(stock_move, self)._prepare_chained_picking(cr, uid, picking_name, picking, picking_type, moves_todo, context=context)
165 if picking.carrier_id:
166 values['carrier_id'] = picking.carrier_id.id
167 values['volume'] = picking.volume
168 values['weight'] = picking.weight
169 values['weight_net'] = picking.weight_net
170 values['carrier_tracking_ref'] = picking.carrier_tracking_ref
171 values['number_of_packages'] = picking.number_of_packages
172 return values
173
163 _columns = {174 _columns = {
164 'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',175 'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
165 store={176 store={
166177
=== added file 'delivery/test/delivery_chained_pickings.yml'
--- delivery/test/delivery_chained_pickings.yml 1970-01-01 00:00:00 +0000
+++ delivery/test/delivery_chained_pickings.yml 2013-06-25 09:37:33 +0000
@@ -0,0 +1,37 @@
1-
2 I create a picking to stock.location_convenience_shop, which is chained with stock.location_refrigerator
3-
4 !record {model: stock.picking, id: shipment_with_delivery}:
5 type: internal
6 carrier_id: delivery.delivery_carrier
7 volume: 42
8 carrier_tracking_ref: FDX123
9 number_of_packages: 7
10-
11 I add a move in the picking
12-
13 !record {model: stock.move, id: icecream_move}:
14 picking_id: shipment_with_delivery
15 product_id: stock.product_icecream
16 product_uom: product.product_uom_kgm
17 product_qty: 130.0
18 location_id: stock.stock_location_suppliers
19 location_dest_id: stock.location_convenience_shop
20-
21 I confirm the picking
22-
23 !workflow {model: stock.picking, action: button_confirm, ref: shipment_with_delivery}
24-
25 I check that the delivery fields have been propagated to the chained picking
26-
27 !python {model: stock.move}: |
28 original_move = self.browse(cr, uid, ref('icecream_move'), context=context)
29 original_picking = original_move.picking_id
30 chained_move = original_move.move_dest_id
31 chained_picking = chained_move.picking_id
32 assert chained_picking.carrier_tracking_ref == original_picking.carrier_tracking_ref, 'no propagation of carrier_tracking_ref'
33 assert chained_picking.carrier_id == original_picking.carrier_id, 'no propagation of carrier_id'
34 assert chained_picking.volume == original_picking.volume, 'no propagation of volume'
35 assert chained_picking.weight == original_picking.weight, 'no propagation of weight'
36 assert chained_picking.weight_net == original_picking.weight_net, 'no propagation of weight'
37