Better name_get on stock_move, to make it easier to analyse the reservation of the quants

This commit is contained in:
Alexis de Lattre
2016-01-27 18:35:29 +01:00
parent f585405498
commit 9b4566a9ec

View File

@@ -86,6 +86,25 @@ class StockMove(models.Model):
availability = fields.Float(
digits=dp.get_precision('Product Unit of Measure'))
def name_get(self, cr, uid, ids, context=None):
'''name_get of stock_move is important for the reservation of the
quants: so want to add the name of the customer and the expected date
in it'''
res = []
for line in self.browse(cr, uid, ids, context=context):
name = line.location_id.name + ' > ' + line.location_dest_id.name
if line.product_id.code:
name = line.product_id.code + ': ' + name
if line.picking_id.origin:
name = line.picking_id.origin + ' ' + name
if line.partner_id:
name = line.partner_id.name + ' ' + name
if line.date_expected:
date_expec_dt = fields.Datetime.from_string(line.date_expected)
name = name + ' ' + fields.Date.to_string(date_expec_dt)
res.append((line.id, name))
return res
class StockMoveOperationLink(models.Model):
_inherit = 'stock.move.operation.link'