This question has been flagged
2438 Views

OpenERP v6.1 on windows. I am trying to add two extra fields in delivery order, one to add extra weight to the gross weight (Weight field) and another to display a new total weight. Can anyone help please thank you in Advance.

 class stock_picking(osv.osv):
  _inherit = 'stock.picking'

def _cal_new_weight(self, cr, uid, ids, wgt, context=None):
    current_weight=weight() #gross weight calculated by the system for delivery products
    weight_addition=weight_added(wgt)
    total_new_weight=current_weight+weight_addition
    val = {
                            'weight_total': total_new_weight,

                          }
    return {'value': val}

_columns = {
    'weight_total': fields.function(_cal_new_weight, type='float', 'Total Weight'),
    'weight_added': fields.float('Extra Weight',select=True, readonly= False),
    }

stock_picking() this code give me no error but the field weight total is not adding up any help please.

Avatar
Discard