|
@@ -164,35 +164,33 @@ class sale_order(models.Model):
|
|
|
self.env['stock.transfer.order.details.items'].create(items)
|
|
|
return self.env['stock.transfer.order.details'].wizard_view(created_id)
|
|
|
|
|
|
-class stock_location(models.Model):
|
|
|
- _inherit = "stock.location"
|
|
|
-
|
|
|
- # @api.multi
|
|
|
- # def name_get(self):
|
|
|
- # if self._context is None:
|
|
|
- # self._context = {}
|
|
|
- # res = []
|
|
|
- # if self._context.get('nombre_para_stock_transfer', False):
|
|
|
- # product = self._context.get('transfer_product_id')
|
|
|
- # for location in self:
|
|
|
- # suma = 0
|
|
|
- # quant_ids = self.env['stock.quant'].search([('product_id','=', product),('location_id','=',location.id)])
|
|
|
- # if quant_ids:
|
|
|
- # for quant_id in quant_ids:
|
|
|
- # suma = suma + quant_id.qty
|
|
|
- #
|
|
|
- # res.append((location.id, ("%(location_parent)s/%(location_name)s %(location_qty)s") % {
|
|
|
- # 'location_parent': location.location_id.name,
|
|
|
- # 'location_name': location.name,
|
|
|
- # 'location_qty': suma
|
|
|
- # }))
|
|
|
- # else:
|
|
|
- # for record in self:
|
|
|
- # res.append((record.id, ("%(location_parent)s/%(location_name)s") % {
|
|
|
- # 'location_parent': record.location_id.name or "",
|
|
|
- # 'location_name': record.name
|
|
|
- # }))
|
|
|
- # return res
|
|
|
+class stock_warehouse(models.Model):
|
|
|
+ _inherit = "stock.warehouse"
|
|
|
+
|
|
|
+ @api.multi
|
|
|
+ def name_get(self):
|
|
|
+ if self._context is None:
|
|
|
+ self._context = {}
|
|
|
+ res = []
|
|
|
+ if self._context.get('nombre_para_stock_transfer', False):
|
|
|
+ product = self._context.get('transfer_product_id')
|
|
|
+ for location in self:
|
|
|
+ suma = 0
|
|
|
+ quant_ids = self.env['stock.quant'].search([('product_id','=', product),('location_id','=',location.lot_stock_id.id)])
|
|
|
+ if quant_ids:
|
|
|
+ for quant_id in quant_ids:
|
|
|
+ suma = suma + quant_id.qty
|
|
|
+
|
|
|
+ res.append((location.id, ("%(location_name)s %(location_qty)s") % {
|
|
|
+ 'location_name': location.name,
|
|
|
+ 'location_qty': suma
|
|
|
+ }))
|
|
|
+ else:
|
|
|
+ for record in self:
|
|
|
+ res.append((record.id, ("%(location_name)s") % {
|
|
|
+ 'location_name': record.name
|
|
|
+ }))
|
|
|
+ return res
|
|
|
|
|
|
class stock_picking(models.Model):
|
|
|
_inherit = 'stock.picking'
|