Odoo Help

Welcome!

This community 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.

1

What is "Invalid field %r in leaf %r" % (left, str(leaf))" ?

By
Anirudh Lou
on 11/17/14, 8:33 PM 2,043 views

Hi every one, do you know what is the cause of invalid field %r in leaf %r means? I don't know why it pops up in my openerp. I am trying to search payslip_id on it's payslip_line using this code:

working_student_id = payslip_obj.search(cr,uid,[('employee_id','=',emp.id),('date_from','>=',start_date_range),('date_to','<=',november_range)],context=context)
                        for payslip in payslip_obj.browse(cr,uid,working_student_id,context=context):
                            netsvc.Logger().notifyChannel("WILL I BE EXCUTED?: ", netsvc.LOG_INFO,str(payslip)+' '+str(payslip.id))
                            cont = payslip.contract_id.id
                            wage_type = payslip.contract_id.emp_type
                            if wage_type == 'monthly':
                                wage_type = 'semi_monthly'
                            line_ids = payslip_line_obj.search(cr,uid,[('payslip_id','=',payslip.id)],context=context)
                            netsvc.Logger().notifyChannel("TRY ONCE AGAIN: ", netsvc.LOG_INFO, 'AM I IN????  ' + str(payslip.id))

When i run it, It canot executes this line:

line_ids = payslip_line_obj.search(cr,uid,[('payslip_id','=',payslip.id)],context=context)

Here is what the terminal says:

raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field 'payslip_id' in leaf "<osv.ExtendedLeaf: ('payslip_id', '=', 4) on hr_payslip_line (ctx: )>"

 

Any explanation is much appreciated.

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 11/18/14, 3:31 AM

The error indicates that payslip_id is not the field of hr_payslip_line.  Based on addons/hr_payroll/hr_payroll.py, is it possible that you should be referring to slip_id instead?

Yes, Ivan. Thanks for pointing out, it is slip_id not payslip_id. Thanks again.

Anirudh Lou
on 12/5/14, 2:38 AM

Does it work after you change to slip_id?

Ivan
on 12/5/14, 3:17 AM

Yeah, it works. Thanks again :)

Anirudh Lou
on 12/19/14, 9:16 PM

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/17/14, 8:33 PM
Seen: 2043 times
Last updated: 3/16/15, 8:10 AM