Hello I'm using Openerp 7 when I do for loop I get
for z in a.res_lot_move_ids:
AttributeError: 'browse_record_list' object has no attribute 'res_lot_move_ids'
I do know that this is possible in odoo 8 an above, so can anyone give me a hint on how to make it work in OpenERP 7?
class SaleOrderLineLot(orm.Model):
_name = 'rp.sale.order.line.lot'
def cancel_order_change_qty(self, cr, uid, line_id, context=None):
lot_line_ids = self.search(cr,uid,[('sale_line_id', '=', line_id.id)], context=context)
self.write(cr,uid,lot_line_ids,{'quantity': 0.0}, context)
a = self.browse(cr, uid,lot_line_ids,context=context )
for z in a.res_lot_move_ids:
print "aa"
return True
_columns = {
'sale_line_id': fields.many2one('sale.order.line', 'Sale Order Line', ondelete='CASCADE'),
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
'pack_id': fields.many2one('stock.tracking', 'Pack'),
'location_id': fields.many2one('stock.location', 'Location'),
'unit_price': fields.float('Unit Price', digits_compute=dp.get_precision('Unit Price')),
'quantity': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure')),
'uom_id': fields.many2one('product.uom', 'Unit of Measure'),
'total_price': fields.float('Total Price', digits_compute=dp.get_precision('Total Price')),
'res_lot_move_ids': fields.many2many('stock.move', 'sale_order_lot_res_moves', 'lot_line_id', 'move_id',
string='Reserved Moves'),
'scrap_lot_move_ids': fields.many2many('stock.move', 'sale_order_lot_scrap_moves', 'lot_line_id', 'move_id',
string='Scrapped Moves'),
}
update: if I print a
I get
[browse_record(rp.sale.order.line.lot, 18881)]