This question has been flagged
1 Reply
3498 Views

Thank you guys for your help with my previous questions. I've been able to pass that stage. Now am getting another this "programming error" : ProgrammingError: operator does not exist: integer = boolean LINE 1: ...,res_users.id FROM "res_users" WHERE res_users.id IN (false)... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

The form I created is supposed to be approved at two levels. Below is my method:

   def create_store_voucher_approvals(self,cr,uid, ids, context=None):
        store_voucher = self.browse(cr, uid, ids, context=context)
        department = store_voucher[0].department_id
        manager_id = department.manager_id.id
        manager_user_id = department.manager_id.user_id.id
        store_voucher_id = [ids[0]]
        store_voucher_approval_obj = self.pool.get('store.voucher.approval')

        store_voucher_approvals = store_voucher_approval_obj.search(cr, uid, [('store_voucher_id','=',store_voucher_id)])


    if not store_voucher_approvals:
        cr.execute("DELETE FROM store_voucher_approval WHERE store_voucher_id=%s", store_voucher_id)
        store_voucher_approval_obj.create(cr, uid, {
                                                     'state': 'in_progress',
                                                     'employee_id': manager_id,
                                                     'store_voucher_id': store_voucher_id[0],
                                                     'role': department.manager_id.job_id.name,
                                                     'can_approve': True
                                                    })
        store = store_voucher[0]                                            
        self.message_subscribe_users(cr, SUPERUSER_ID, [store.id] , user_ids=[manager_user_id], context=context)
        manager_id = self.pool.get('store.voucher.manager').search(cr, uid, [])
        store_voucher_managers= self.pool.get('store.voucher.manager').browse(cr, uid,manager_id)
        for store_voucher_manager in store_voucher_managers:
            manager_id = store_voucher_manager.employee_id.id
            manager_user_id = store_voucher_manager.employee_id.user_id.id
            store_voucher_approval_obj.create(cr, uid, {
                                                     'state': 'in_progress',
                                                     'employee_id': manager_id,
                                                     'store_voucher_id': store_voucher_id[0],
                                                     'role': store_voucher_manager.role
                                                    })

        self.message_subscribe_users(cr, SUPERUSER_ID, [store.id] , user_ids=[manager_user_id], context=context)
    return True

Please does anyone know why am getting this error? And how can I solve it?? thank you

Avatar
Discard
Best Answer

Hi Jay, Trace your code using,

print "manager_user_id",manager_user_id

then check what you find in terminal,

I am sure while you fetching manager_user_id , you will got false at that time. try to set user_id in your department's manager's id.

Avatar
Discard