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.

0

"Invalid field 'day' in leaf " Module hr_attendance V8

By
Juan
on 10/10/16, 7:54 AM 133 views

I'm getting this error when I try this :

att_obj = self.pool.get('hr.attendance')
att_id = att_obj.search(cr, uid, [('employee_id', '=', employee_id),('day', '=', time.strftime('%Y-%m-%d'))], limit=1, order='name desc')


1

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 10/10/16, 10:34 AM

Hi,

This message alert you that field day is not defined in model hr.attendance.

class hr_attendance(osv.osv):
_name = "hr.attendance" _description = "Attendance"
_columns = {
        'name': fields.datetime('Date', required=True, select=1),
        'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True),
        'action_desc': fields.many2one("hr.action.reason", "Action Reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'),
        'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True),
        'worked_hours': fields.function(_worked_hours_compute, type='float', string='Worked Hours', store=True), }

So, try this instead:

att_obj = self.pool.get('hr.attendance')
att_id = att_obj.search(cr, uid, [('employee_id', '=', employee_id),('name', '=', time.strftime('%Y-%m-%d'))], limit=1, order='name desc')

Best regards



Thanks it works, I saw the field day in the model hr.attendance in Configuration->Database Structure -> Models

Juan
on 10/11/16, 3:56 AM

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: 10/10/16, 7:54 AM
Seen: 133 times
Last updated: 10/11/16, 3:56 AM