[REF] stock: Task ID-575:Replaced scraped field on a stock.move by a related field in stock module.
bzr revid: uco@tinyerp.co.in-20100428103202-8ctirorhnytzctf6
This commit is contained in:
parent
6ee58526f8
commit
a51e1755de
|
@ -101,7 +101,6 @@ class StockMove(osv.osv):
|
|||
_columns = {
|
||||
'production_id': fields.many2one('mrp.production', 'Production', select=True),
|
||||
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
|
||||
'scraped': fields.related('location_dest_id','scraped',type='boolean',relation='stock.location',string='Scraped'),
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
|
@ -205,10 +204,6 @@ class StockMove(osv.osv):
|
|||
"""
|
||||
res = []
|
||||
production_obj = self.pool.get('mrp.production')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
location = location_obj.browse(cr, uid, location_id)
|
||||
if not location.scraped:
|
||||
raise osv.except_osv(_('Warning !'),_('Please select scraped location.'))
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for move in self.browse(cr, uid, ids):
|
||||
new_moves = super(StockMove, self).action_scrap(cr, uid, [move.id], product_qty, location_id, context=context)
|
||||
|
|
|
@ -1214,7 +1214,7 @@ class stock_move(osv.osv):
|
|||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
|
||||
'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True),
|
||||
'delivered_id': fields.many2one('stock.delivery', 'Product delivered'),
|
||||
'scraped': fields.boolean('Scraped'),
|
||||
'scraped': fields.related('location_dest_id','scraped',type='boolean',relation='stock.location',string='Scraped'),
|
||||
}
|
||||
_constraints = [
|
||||
(_check_tracking,
|
||||
|
@ -1251,7 +1251,6 @@ class stock_move(osv.osv):
|
|||
'location_dest_id': _default_location_destination,
|
||||
'state': lambda *a: 'draft',
|
||||
'priority': lambda *a: '1',
|
||||
'scraped' : lambda *a:False,
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
|
|
|
@ -81,8 +81,6 @@ class stock_move_consume(osv.osv_memory):
|
|||
"""
|
||||
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
location_obj = self.pool.get('stock.location')
|
||||
scrpaed_location_ids = location_obj.search(cr, uid, [('scraped','=',True)])
|
||||
if 'product_id' in fields:
|
||||
res.update({'product_id': move.product_id.id})
|
||||
if 'product_uom' in fields:
|
||||
|
@ -90,10 +88,7 @@ class stock_move_consume(osv.osv_memory):
|
|||
if 'product_qty' in fields:
|
||||
res.update({'product_qty': move.product_qty})
|
||||
if 'location_id' in fields:
|
||||
if scrpaed_location_ids:
|
||||
res.update({'location_id': scrpaed_location_ids[0]})
|
||||
else:
|
||||
res.update({'location_id': False})
|
||||
res.update({'location_id': move.location_id.id})
|
||||
return res
|
||||
|
||||
def do_move_consume(self, cr, uid, ids, context={}):
|
||||
|
|
Loading…
Reference in New Issue