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

ProgrammingError: operator does not exist: integer = boolean

By
Shaumyadeep Chaudhuri
on 1/24/14, 7:58 AM 1,944 views

I'm trying to modify the hr.contract model and add a one2many field to create a payroll history structure. The problem is if I use it then i am getting the error.

File "/opt/openerp/server-6.0/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server-6.0/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server-6.0/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/server-6.0/bin/osv/orm.py", line 1647, in fields_view_get
    xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
  File "/opt/openerp/server-6.0/bin/osv/orm.py", line 1338, in __view_look_dom_arch
    cr.execute('select name, model from ir_ui_view where (id=%s or inherit_id=%s) and arch like %s', (view_id, view_id, '%%%s%%' % field))
  File "/opt/openerp/server-6.0/bin/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/openerp/server-6.0/bin/sql_db.py", line 131, in execute
    res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: select name, model from ir_ui_view where (id=false or inheri...
                                                    ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Here are the classes i'm trying to create

class ssdn_hr_payroll_history(osv.osv):
    _name = "ssdn.hr.payroll.history"
    _columns = {
                'contract_id':fields.many2one('hr.contract', 'Contract ID'),
                'head_id':fields.many2one('hr.allounce.deduction.categoty', 'Payroll Head'),
                'amount_type':fields.selection([
                                                ('per', 'Percentage (%)'),
                                                ('fix', 'Fixed Amount'),
                                                ('func', 'Function Value'),
                                                ], 'Amount Type', select=True),
                'amount':fields.float('Amount'),
                'date':fields.date('Date of Change')
                }

class hr_contract(osv.osv):
    _inherit = 'hr.contract'
    _columns = {
                'payroll_history':fields.one2many('ssdn.hr.payroll.history','contract_id','Payroll History'),
                }
    def write(self, cr, uid, ids, vals, context=None):
        if vals.get('wage'):
            head_id = self.pool.get('hr.allounce.deduction.categoty').search(cr, uid, [('code', '=', 'BAS')])
            self.pool.get('ssdn.hr.payroll.history').create(cr, uid, {'contract_id':ids[0], 'head_id':head_id,
                                                                      'amount':self.browse(cr, uid, ids, context=context)[0].wage,
                                                                      'amount_type':'fix', 'date':datetime.now().strftime('%Y-%m-%d %H:%M:%S')
                                                                      }, context=context)
        return super(hr_contract, self).write(cr, uid, id, vals, context=context)

What could be the problem? The error as expected only occurs if i am including the column in the view

1
Julien Laloux
On 1/24/14, 9:24 AM

Have you defined the views for this model "ssdn.hr.payroll.history"?

oops, that was the problem. I have mostly worked with V7 and this is a not problem with it

Shaumyadeep Chaudhuri
on 1/24/14, 9:29 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: 1/24/14, 7:58 AM
Seen: 1944 times
Last updated: 3/16/15, 8:10 AM