+ # Assign dates according to products data
+ def create(self, cr, uid, vals, context=None):
+ newid = super(stock_production_lot, self).create(cr, uid, vals, context=context)
+ obj = self.browse(cr, uid, newid, context=context)
+ towrite = []
+ for f in ('life_date', 'use_date', 'removal_date', 'alert_date'):
+ if not getattr(obj, f):
+ towrite.append(f)
+ if context is None:
+ context = {}
+ context['product_id'] = obj.product_id.id
+ self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context))
+ return newid