from openerp import models, fields, api


class StockProductionlot(models.Model):

    _inherit = 'stock.production.lot'

    qty_available_not_res = fields.Float(
        compute='_compute_qty_available_not_res',
        string='Qty Available Not Reserved',
        store=True
    )

    @api.multi
    @api.depends('quant_ids.reservation_id', 'quant_ids.qty')
    def _compute_qty_available_not_res(self):
        for rec in self:
            rec.qty_available_not_res = sum(rec.quant_ids.filtered(
                lambda x: not x.reservation_id).mapped('qty'))

    @api.multi
    def name_get(self):
        result = []
        for rec in self:
            name = '%s (%s u)' % (rec.name, rec.qty_available_not_res or 0.0)
            result.append((rec.id, name))
        return result

from openerp import models, fields, api


class StockProductionlot(models.Model):

    _inherit = 'stock.production.lot'

    qty_available_not_res = fields.Float(
        compute='_compute_qty_available_not_res',
        string='Qty Available Not Reserved',
        store=True
    )

    @api.multi
    @api.depends('quant_ids.reservation_id', 'quant_ids.qty')
    def _compute_qty_available_not_res(self):
        for rec in self:
            rec.qty_available_not_res = sum(rec.quant_ids.filtered(
                lambda x: not x.reservation_id).mapped('qty'))

    @api.multi
    def name_get(self):
        result = []
        for rec in self:
            read = rec.quant_ids.read_group(
                [('lot_id', '=', rec.id)],
                ['location_id', 'qty'], 'location_id')
            locations_qty = ', '.join(
                ['%s: %s' % (x['location_id'][1], x['qty']) for x in read])
            name = '%s (%s)' % (rec.name, locations_qty)
            result.append((rec.id, name))
        return result

FIX in lot name_get to show location with the stock
FIX in lot name_get to show location with the stock

  from openerp import models, fields, api
  
  
  class StockProductionlot(models.Model):
  
      _inherit = 'stock.production.lot'
  
      qty_available_not_res = fields.Float(
          compute='_compute_qty_available_not_res',
          string='Qty Available Not Reserved',
          store=True
      )
  
      @api.multi
      @api.depends('quant_ids.reservation_id', 'quant_ids.qty')
      def _compute_qty_available_not_res(self):
          for rec in self:
              rec.qty_available_not_res = sum(rec.quant_ids.filtered(
                  lambda x: not x.reservation_id).mapped('qty'))
  
      @api.multi
      def name_get(self):
          result = []
          for rec in self:
-             name = '%s (%s u)' % (rec.name, rec.qty_available_not_res or 0.0)
+             read = rec.quant_ids.read_group(
+                 [('lot_id', '=', rec.id)],
+                 ['location_id', 'qty'], 'location_id')
+             locations_qty = ', '.join(
+                 ['%s: %s' % (x['location_id'][1], x['qty']) for x in read])
+             name = '%s (%s)' % (rec.name, locations_qty)
              result.append((rec.id, name))
          return result
  
FIX in lot name_get to show location with the stock
## Code Before:
from openerp import models, fields, api


class StockProductionlot(models.Model):

    _inherit = 'stock.production.lot'

    qty_available_not_res = fields.Float(
        compute='_compute_qty_available_not_res',
        string='Qty Available Not Reserved',
        store=True
    )

    @api.multi
    @api.depends('quant_ids.reservation_id', 'quant_ids.qty')
    def _compute_qty_available_not_res(self):
        for rec in self:
            rec.qty_available_not_res = sum(rec.quant_ids.filtered(
                lambda x: not x.reservation_id).mapped('qty'))

    @api.multi
    def name_get(self):
        result = []
        for rec in self:
            name = '%s (%s u)' % (rec.name, rec.qty_available_not_res or 0.0)
            result.append((rec.id, name))
        return result

## Instruction:
FIX in lot name_get to show location with the stock
## Code After:
from openerp import models, fields, api


class StockProductionlot(models.Model):

    _inherit = 'stock.production.lot'

    qty_available_not_res = fields.Float(
        compute='_compute_qty_available_not_res',
        string='Qty Available Not Reserved',
        store=True
    )

    @api.multi
    @api.depends('quant_ids.reservation_id', 'quant_ids.qty')
    def _compute_qty_available_not_res(self):
        for rec in self:
            rec.qty_available_not_res = sum(rec.quant_ids.filtered(
                lambda x: not x.reservation_id).mapped('qty'))

    @api.multi
    def name_get(self):
        result = []
        for rec in self:
            read = rec.quant_ids.read_group(
                [('lot_id', '=', rec.id)],
                ['location_id', 'qty'], 'location_id')
            locations_qty = ', '.join(
                ['%s: %s' % (x['location_id'][1], x['qty']) for x in read])
            name = '%s (%s)' % (rec.name, locations_qty)
            result.append((rec.id, name))
        return result
