Quantcast
Channel: OpenERP Help - Individual question feed
Viewing all articles
Browse latest Browse all 68

How to populate a lot of fields?

$
0
0
What is wrong with this function? Is supposed to retrieve the routing_id of the object mrp.production and store it in the mrp.production.workcenter.line one, but doing everything but that. Is there something wrong with the logic? def set_routing_id(self, cr, uid, ids, context=None): """Routing_id automatically fills the records using ORM methods.""" mrp_production_object = self.pool.get("mrp.production") work_orders = self.browse(cr, uid, ids, context=None) result ={} for order in work_orders: ids_production = mrp_production_object.search(cr, uid, [('id','=',order.production_id)], limit=1, context=None) production = mrp_production_object.browse(cr, uid, ids_production, context=None) try: result[order.id] = production[0].routing_id return result[order.id] except: result[order.id] = 0 return result[order.id] _columns = { 'routing_id':fields.integer('routing_id'), } _defaults = { 'routing_id':set_routing_id

Viewing all articles
Browse latest Browse all 68

Trending Articles