~zaber/openobject-addons/stable_5.0-extra-addons

« back to all changes in this revision

Viewing changes to fleet_maintenance/sale.py

  • Committer: Raphaël Valyi
  • Date: 2010-05-05 13:59:08 UTC
  • mfrom: (4313.2.1 extra-5.0)
  • mto: This revision was merged to the branch mainline in revision 4317.
  • Revision ID: rvalyi@gmail.com-20100505135908-816t3w7v5z3momuj
[MERGE] fleet_maintenance now deliver products to the order specified fleet extension both with single and double steps delivery modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
235
235
 
236
236
class sale_order(osv.osv):
237
237
    _inherit = "sale.order"
238
 
    
 
238
 
239
239
    _columns = {
240
240
        'fleet_id': fields.many2one('stock.location', 'Default Sub Fleet'), #TODO call that sub_fleet_id ?
241
241
    }
242
242
 
243
243
    def action_ship_create(self, cr, uid, ids, *args):
 
244
 
244
245
        result = super(sale_order, self).action_ship_create(cr, uid, ids, *args)
245
 
        
 
246
 
246
247
        for order in self.browse(cr, uid, ids):
 
248
            
247
249
            for order_line in order.order_line:
248
250
                if order_line.fleet_id:
249
251
                    for move in order_line.move_ids:
250
 
                        self.pool.get('stock.move').write(cr, uid, move.id, {'location_dest_id':order_line.fleet_id.id})
251
 
        return result
252
 
                    
253
 
 
 
252
                        if order.shop_id.warehouse_id.lot_output_id.chained_auto_packing == 'transparent':
 
253
                            if move.state not in ('cancel', 'done'):
 
254
                                self.pool.get('stock.move').write(cr, uid, move.id, {'location_dest_id':order_line.fleet_id.id})
 
255
                        else:
 
256
                            if move.state in ('draft','waiting'):
 
257
                                self.pool.get('stock.move').write(cr, uid, move.id, {'location_dest_id':order_line.fleet_id.id})
 
258
        result
 
259
      
254
260
sale_order()