Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Artificial Intelligence
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Property Management
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

I am getting this error DataError: invalid input syntax for integer: "{'random_seller_info_id': 6}"

Subscriure's

Get notified when there's activity on this post

This question has been flagged
odooV8
2 Respostes
22678 Vistes
Avatar
Emmanuel Roldan

I am getting this error can anyone help?

Here is the Traceback :

    Traceback (most recent call last):
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 462, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 481, in dispatch
    result = self._call_function(**self.params)
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 297, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:/GreenOdoo-master-win32/source\openerp\service\model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 294, in checked_call
    return self.endpoint(*a, **kw)
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 671, in __call__
    return self.method(*args, **kw)
  File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 346, in response_wrap
    response = f(*args, **kw)
  File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1046, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1038, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "C:/GreenOdoo-master-win32/source\openerp\osv\orm.py", line 4264, in create
    self.pool[model_name]._store_set_values(cr, user, ids, fields2, context)
  File "C:/GreenOdoo-master-win32/source\openerp\osv\orm.py", line 4430, in _store_set_values
    '"'+f+'"='+self._columns[f]._symbol_set[0] + ' where id = %s', (self._columns[f]._symbol_set[1](value), id))
  File "C:/GreenOdoo-master-win32/source\openerp\sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "C:/GreenOdoo-master-win32/source\openerp\sql_db.py", line 230, in execute
    res = self._obj.execute(query, params)
DataError: invalid input syntax for integer: "{'random_seller_info_id': 6}"
LINE 1: ...oans_e3loan_services" set "random_seller_info_id"='{''random...
                                                                                                    ^

and my code:

class itaconloans_e3loan_services(osv.osv):
    """ Itacon loans application 'E3 Loan Application services' """
    _name = 'itaconloans.e3loan.services'
    _description = 'Loans services'

    def get_product_provider(self, cr, uid, ids, args, field_names, context=None):
        res = {}
        for record in self.browse(cr, uid, ids, context=context):
            cr.execute('''select name from product_supplierinfo where product_tmpl_id in (select id from product_template) order by RANDOM() limit 1''')
            val = cr.fetchone()
            if val:
                res[record.id] = {'random_seller_info_id': val[0]}
                res[record.id]['random_seller_info_id'] = val[0]

        return res


    _columns = {
        'ServicesID': fields.char('Services ID', size=15),
        'product_id': fields.many2one('product.product', 'name', 'Service Name'),

        'AppNum': fields.many2one('itaconloans.e3loan', 'Application Number', select=True),

        'provider': fields.many2one('res.partner', 'Provider Name', select=True),

        'DateReq': fields.date('Date Requested'),
        'DateComp': fields.date('Date Completed'),
        'DateToComp': fields.date('Date To Complete'),
        'comments': fields.text('Comments', translate=True),

        'random_seller_info_id': fields.function(get_product_provider, type='many2one', relation="product.supplierinfo", string="Random Supplier", store=True),
    }

itaconloans_e3loan_services()

0
Avatar
Descartar
Emmanuel Roldan
Autor

Thank you prakash, it got rid of that error. But now I am getting: Traceback (most recent call last): File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 462, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 481, in dispatch result = self._call_function(**self.params) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 297, in _call_function return checked_call(self.db, *args, **kwargs) File "C:/GreenOdoo-master-win32/source\openerp\service\model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 294, in checked_call return self.endpoint(*a, **kw) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 671, in __call__ return self.method(*args, **kw) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 346, in response_wrap response = f(*args, **kw) File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1050, in call_button action = self._call_kw(model, method, args, {}) File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1038, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) TypeError: get_product_provider() takes at least 6 arguments (5 given)

Avatar
Prakash
Best Answer

In your code random_seller_info_id function field type 'many2one' but in the code sql select statement return the name of the product_supplierinfo change into ID.

Example,

    def get_product_provider(self, cr, uid, ids, args, field_names, context=None):
        res = {}
        for record in self.browse(cr, uid, ids, context=context):
            cr.execute('''select id from product_supplierinfo where product_tmpl_id in (select id from product_template) order by RANDOM() limit 1''')
            val = cr.fetchone()
            if val:
                res[record.id] = val[0]

          else:

               res[record.id] = False

return res

EDIT:-

https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/field_type/

The id of the function is retrieved using a SQL query. Note that if the query returns no result, the value of sql res will be None. We force the False value in this case value because XML:RPC (communication between the server and the client) doesn't allow to transmit this value.

1
Avatar
Descartar
Avatar
Emmanuel Roldan
Autor Best Answer

Thank you prakash, it got rid of that error. But now I am getting: Traceback (most recent call last): File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 462, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 481, in dispatch result = self._call_function(**self.params) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 297, in _call_function return checked_call(self.db, *args, **kwargs) File "C:/GreenOdoo-master-win32/source\openerp\service\model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 294, in checked_call return self.endpoint(*a, **kw) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 671, in __call__ return self.method(*args, **kw) File "C:/GreenOdoo-master-win32/source\openerp\http.py", line 346, in response_wrap response = f(*args, **kw) File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1050, in call_button action = self._call_kw(model, method, args, {}) File "C:\GreenOdoo-master-win32\source\addons\web\controllers\main.py", line 1038, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) TypeError: get_product_provider() takes at least 6 arguments (5 given)

0
Avatar
Descartar
Prakash

Hi, see the functional document:- https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/field_type/ i updated my code based on the examples given in the document.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
{{Hablar@Representante@Klm}} ¿Cómo llamar a KLM desde Panamá?
odooV8
Avatar
0
de juny 26
93
How Odoo Is Revolutionizing Business Management?
odooV8
Avatar
0
de juny 26
8
Hidden Odoo Features That Businesses Often Overlook?
odooV8
Avatar
0
de juny 26
3
Helpful Odoo Resources
odooV8
Avatar
0
de maig 26
1
Odoo Technical Stack
odooV8
Avatar
0
de maig 26
5
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now