[FIX]order stock_inventory_line by location name, product code, product name
lp bug: https://launchpad.net/bugs/1087033 fixed bzr revid: ls@numerigraphe.com-20140311174505-p086c5nzvpifqxky
This commit is contained in:
parent
b38381919a
commit
bc616fce91
|
@ -2867,6 +2867,14 @@ class stock_inventory_line(osv.osv):
|
|||
_name = "stock.inventory.line"
|
||||
_description = "Inventory Line"
|
||||
_rec_name = "inventory_id"
|
||||
_order = "inventory_id, location_name, product_code, product_name, prod_lot_id"
|
||||
|
||||
def _get_product_name_change(self, cr, uid, ids, context=None):
|
||||
return self.pool.get('stock.inventory.line').search(cr, uid, [('product_id', 'in', ids)], context=context)
|
||||
|
||||
def _get_location_change(self, cr, uid, ids, context=None):
|
||||
return self.pool.get('stock.inventory.line').search(cr, uid, [('location_id', 'in', ids)], context=context)
|
||||
|
||||
_columns = {
|
||||
'inventory_id': fields.many2one('stock.inventory', 'Inventory', ondelete='cascade', select=True),
|
||||
'location_id': fields.many2one('stock.location', 'Location', required=True),
|
||||
|
@ -2876,6 +2884,15 @@ class stock_inventory_line(osv.osv):
|
|||
'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True, select=True, readonly=True),
|
||||
'prod_lot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
|
||||
'state': fields.related('inventory_id','state',type='char',string='Status',readonly=True),
|
||||
'product_name': fields.related('product_id', 'name', type='char', string='Product name', store={
|
||||
'product.product': (_get_product_name_change, ['name', 'default_code'], 20),
|
||||
'stock.inventory.line': (lambda self, cr, uid, ids, c={}: ids, ['product_id'], 20),}),
|
||||
'product_code': fields.related('product_id', 'default_code', type='char', string='Product code', store={
|
||||
'product.product': (_get_product_name_change, ['name', 'default_code'], 20),
|
||||
'stock.inventory.line': (lambda self, cr, uid, ids, c={}: ids, ['product_id'], 20),}),
|
||||
'location_name': fields.related('location_id', 'complete_name', type='char', string='Location name', store={
|
||||
'stock.location': (_get_location_change, ['name', 'location_id', 'active'], 20),
|
||||
'stock.inventory.line': (lambda self, cr, uid, ids, c={}: ids, ['location_id'], 20),}),
|
||||
}
|
||||
|
||||
def _default_stock_location(self, cr, uid, context=None):
|
||||
|
|
Loading…
Reference in New Issue