Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
def onchange_start_date_past(self, cr, uid, ids, start_date, eofdate, context=None):
chng_year = datetime.datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
holiday_line_id = self.browse(cr, uid, ids, context=context).holiday_line_id
chng_year = self.pool.get('holiday').browse(cr, uid, holiday_line_id.id, context=context).year
if chng_year != year:
raise osv.except_osv(_('Warning!'),_('Please enter correct Year.'))
return super(year, self).unlink(cr, uid, ids, context=context)
i am getting issue in line num 3. that is "list index out of range".
what is the issue in parameter given.
If the record is not saved than in onchange method you will not receive any of the 'ids', it will be an empty or False, therefore it is throwing that error to you. You should check if there is anything in the 'ids' or not. Once the record is saved than you will receive the value in ids.
Hope this helps !!.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/19/15, 6:50 AM|
|Seen: 398 times|
|Last updated: 3/16/15, 8:10 AM|