iam trying to add scheduled action to add leave allocation for each employee who dose not have running leave
i make the below script
class scheduler_demo(models.Model):
_name = 'scheduler.demo'
def _daily_leaves(self):
test = self.env['hr.employee'].sudo().search([])
for t in test.ids:
holidays = self.env['hr.employee'].sudo().search([
('id', '=', t),
('current_leave_id', '=', '1')
])
for line in holidays.ids:
leave = self.env['hr.holidays'].create({
'employee_id': line,
'holiday_status_id': '1',
'type': 'add',
'holiday_type': 'employee',
'number_of_days_temp': '8'
})
leave.action_approve()
if leave.double_validation:
leave.action_validate()
i received the below error
2019-01-19 09:26:31,848 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:31,957 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,081 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,193 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,302 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,440 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,549 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,665 26852 ERROR test4q odoo.osv.expression: Non-stored field hr.employee.current_leave_id cannot be searched. 2019-01-19 09:26:32,835 26852 INFO test4q werkzeug: 127.0.0.1 - - [19/Jan/2019 09:26:32] "POST /web/dataset/call_button HTTP/1.1" 200 - 2019-01-19 09:26:32,865 26852 INFO test4q werkzeug: 127.0.0.1 - - [19/Jan/2019 09:26:32] "POST /web/dataset/call_kw/ir.cron/search_read HTTP/1.1" 200 - 2019-01-19 09:26:33,163 26852 INFO test4q werkzeug: 127.0.0.1 - - [19/Jan/2019 09:26:33] "POST /web/menu/load_needaction HTTP/1.1" 200 - 2019-01-19 09:26:33,184 26852 INFO test4q werkzeug: 127.0.0.1 - - [19/Jan/2019 09:26:33] "POST /web/dataset/search_read HTTP/1.1" 200 - 2019-01-19 09:26:35,098 26852 INFO ? odoo.addons.bus.models.bus: Bus.loop listen imbus on db postgres
Hello Bassam Alsibai,
I m encountering same issue can you help me out in same ? Because my field has to be non storede