Skip to Content
Menú
This question has been flagged
1 Respondre
6186 Vistes

I got this problem when adding record

OpenERP Server Error

Client Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, **self.params) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1128, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(*args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info) Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4230, in write 'where id IN %s', upd1 + [sub_ids]) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper return f(self, *args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) ProgrammingError: operator does not exist: integer = boolean LINE 1: ...d=1,write_date=(now() at time zone 'UTC') where id IN (true) ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

My code is at below:

import logging
from openerp.osv import fields, osv

class location(osv.osv):

    _inherit = "stock.location"
    _logger = logging.getLogger(__name__)
    
    _columns = {
        'usage':fields.selection((('Internal','Internal'),('Production','Production'),('Supplier','Supplier'),('Customer','Customer'),('Procurement','Procurement')),'Location Type', required=True),
        'active_status':fields.char('Active Status',size=1),
        'parent location name':fields.char('Parent Location Name', size=64),
        'location name':fields.char('Location Name',size=64),
        'warehouse name':fields.selection((('FG','Finished Good'),('SFG','Semi-Finished Good'),('RM','Row Material')),'Warehouse Name',size=64 ,required=True),
        'status':fields.char('Status',size=64),
        'active flag':fields.char('Active Flag',size=1),
        'shelf type':fields.selection((('6bin','Shelf with 6 bin location'),('4bin','Shelf with 4 bin location'),('sp','Single pallet'),('mp','Multiple pallet'),('c','Cart'),('r','Room')),'Shelf Type', size=64),
        'shelf number':fields.char('Shelf Number',size=64),
        'bin location':fields.char('Bin Location',size=64),
        'capacity':fields.integer('Capacity'),
        'capacity unit':fields.selection((('Pallet','Pallet'),('Carton','Carton'),('Piece','Piece'),('Others','Others')),'Capacity Type',size=64, required=True),
        'building name':fields.char('Building Name', size=64, required=True),
        'mother location':fields.boolean('Parent Location?'),
    }
        
    def create(self, cr, uid, values, context=None):

        names = self.pool.get("stock.location").search(cr, uid, [("name","=", values.get('name'))])
        if names :
            return True;
        else:
            return False;
        
    def change_location_name(self, cr, uid, ids, unit1, unit2, unit3, mother, context=None):
        values = {}
        if not mother:
            #cust = self.pool.get('stock.location').browse(cr, uid, capacity, context=context)
            values['name'] = (unit1 if unit1 else '') + '-' + (unit2 if unit2 else '') + '-' + (unit3 if unit3 else '')

        return {'value' : values};
        
location()

 

Avatar
Descartar
Best Answer

Hi,

"create" method is one of the ORM method and it is always return integer (new ID). over here you are returning boolean. thats why this error is arise.

I hope you will fix this.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
4
de gen. 24
13180
2
de des. 23
17907
3
de juny 24
2512
2
de jul. 21
6468
0
de set. 18
2675