when I try to run below code i got this error
==================================================
File "/home/user/odoo/addons/sale_validation/sale.py", line 708, in on_change_line_product
first_line_rec = self.browse(cr, uid, ids, context=context)[0]
File "/home/user/odoo/openerp/models.py", line 5476, in __getitem__
return self._browse(self.env, (self._ids[key],))
IndexError: tuple index out of range
=================================
class purchase_order_line(osv.osv):
_inherit = 'purchase.order.line'
def on_change_line_product(self, cr, uid, ids,product_qty,context=None):
if context is None: context = {}
res = {}
line_num = 1
first_line_rec = self.browse(cr, uid, ids, context=context)[0]
for line_rec in first_line_rec.order_id.order_line:
res[line_rec.id] = line_num
line_num += 1
return res
_columns={
'line_no': fields.integer(string='Line Number'),
}
xml tag---------------
<field name="line_no" on_change="on_change_line_product(product_qty,context)"/>