Пример #1
0
 def write(self, cr, uid, ids, vals, context=None):            
     if not isinstance(ids, (int, long)):
         write_id = ids[0]
     else:
         write_id = ids
     set_seq_o2m(cr, uid, vals.get('order_line'), 'sale_order_line', 'order_id', write_id, context=context)  
     resu = super(sale_order, self).write(cr, uid, ids, vals, context=context)
     if 'state' in vals and vals['state'] == 'agreed':
         #check serials
         order_line_obj = self.pool.get('sale.order.line')
         for order in self.browse(cr, uid, ids, context=context):
             for order_line in order.order_line:
                 msg = order_line_obj._check_serial(cr, uid, exclude_soln_id = order_line.id, context=context)
                 if msg:
                     raise osv.except_osv(_('Error'),msg)            
     return resu
Пример #2
0
 def create(self, cr, uid, data, context=None):        
     set_seq_o2m(cr, uid, data.get('order_line'), context=context)
     return super(sale_order, self).create(cr, uid, data, context)