|
@@ -99,18 +99,16 @@ class stock_transfer_details(models.TransientModel):
|
|
|
move_id = self.env['stock.move'].create(move)
|
|
|
move_id.action_done()
|
|
|
sale = self.env['sale.order'].search([('id','=',self.sale_id.id)])
|
|
|
- sale.write({'state': 'manual'})
|
|
|
+ sale.write({'state': 'manual','transfered':True})
|
|
|
return True
|
|
|
|
|
|
@api.multi
|
|
|
def get_location_qty(self, product_id, location_id):
|
|
|
- location_ids = self.env['stock.location'].search([('active','=',True),('usage','=','internal'),('id','!=',self.picking_type_id.default_location_dest_id.id)])
|
|
|
- for id in location_ids:
|
|
|
- suma = 0
|
|
|
- quant_ids = self.env['stock.quant'].search([('product_id','=', product_id),('location_id','=',location_id)])
|
|
|
- if quant_ids:
|
|
|
- for quant_id in quant_ids:
|
|
|
- suma = suma + quant_id.qty
|
|
|
+ suma = 0
|
|
|
+ quant_ids = self.env['stock.quant'].search([('product_id','=', product_id),('location_id','=',location_id)])
|
|
|
+ if quant_ids:
|
|
|
+ for quant_id in quant_ids:
|
|
|
+ suma = suma + quant_id.qty
|
|
|
return suma
|
|
|
|
|
|
class stock_transfer_details_items(models.TransientModel):
|
|
@@ -201,7 +199,7 @@ class stock_picking(models.Model):
|
|
|
for move in item.move_lines:
|
|
|
if move.product_id.type == 'product':
|
|
|
uom_record = move.product_id.uom_id
|
|
|
- qty_available = self.get_location_qty(move.product_id.id, move.location_id.id, move.picking_type_id.id)
|
|
|
+ qty_available = self.get_location_qty(move.product_id.id, move.location_id.id)
|
|
|
compare_qty = float_compare(qty_available, move.product_uom_qty, precision_rounding=uom_record.rounding)
|
|
|
|
|
|
if compare_qty == -1:
|
|
@@ -214,13 +212,10 @@ class stock_picking(models.Model):
|
|
|
return True
|
|
|
|
|
|
@api.multi
|
|
|
- def get_location_qty(self, product_id, location_id, picking_type_id):
|
|
|
- picking_type = self.env['stock.picking.type'].browse(picking_type_id)
|
|
|
- location_ids = self.env['stock.location'].search([('active','=',True),('usage','=','internal'),('id','!=',picking_type.default_location_dest_id.id)])
|
|
|
- for id in location_ids:
|
|
|
- suma = 0
|
|
|
- quant_ids = self.env['stock.quant'].search([('product_id','=', product_id),('location_id','=',location_id)])
|
|
|
- if quant_ids:
|
|
|
- for quant_id in quant_ids:
|
|
|
- suma = suma + quant_id.qty
|
|
|
+ def get_location_qty(self, product_id, location_id):
|
|
|
+ suma = 0
|
|
|
+ quant_ids = self.env['stock.quant'].search([('product_id','=', product_id),('location_id','=',location_id)])
|
|
|
+ if quant_ids:
|
|
|
+ for quant_id in quant_ids:
|
|
|
+ suma = suma + quant_id.qty
|
|
|
return suma
|