[FIX] delivery: the stock.picking.{in,out} workaround was only partial
authorOlivier Dony <odo@openerp.com>
Tue, 19 Nov 2013 18:18:55 +0000 (19:18 +0100)
committerOlivier Dony <odo@openerp.com>
Tue, 19 Nov 2013 18:18:55 +0000 (19:18 +0100)
Due to a framework limitation the virtual stock.picking.in
and stock.picking.out models need to duplicate the extra
columns added to the stock.picking master model.
This was only partially done, leading to errors in
some cases when stock.picking.{in,out} were directly
used by business methods.

bzr revid: odo@openerp.com-20131119181855-cciozs8fv3ll9bd8

addons/delivery/stock.py

index 95b17a8..e96daea 100644 (file)
@@ -189,6 +189,9 @@ stock_move()
 # Redefinition of the new fields in order to update the model stock.picking.out in the orm
 # FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). It should be removed as soon as
 #        the bug is fixed
+
+# TODO in trunk: Remove the duplication below using a mixin class!
+
 class stock_picking_out(osv.osv):
     _inherit = 'stock.picking.out'
 
@@ -214,6 +217,7 @@ class stock_picking_out(osv.osv):
                  }),
         'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
         'number_of_packages': fields.integer('Number of Packages'),
+        'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of measurement for Weight",),
         }
 stock_picking_out()
 
@@ -227,6 +231,8 @@ class stock_picking_in(osv.osv):
         return self.pool.get('stock.picking')._get_picking_line(cr, uid, ids, context=context)
 
     _columns = {
+        'carrier_id':fields.many2one("delivery.carrier","Carrier"),
+        'volume': fields.float('Volume'),
         'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
                 store={
                 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
@@ -237,6 +243,9 @@ class stock_picking_in(osv.osv):
                 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
                 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
                 }),
+        'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
+        'number_of_packages': fields.integer('Number of Packages'),
+        'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of measurement for Weight",),
         }
 stock_picking_in()