Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Intelligenza artificiale
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
odooV8
2 Risposte
22682 Visualizzazioni
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
Abbandona
Emmanuel Roldan
Autore

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
Risposta migliore

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
Abbandona
Avatar
Emmanuel Roldan
Autore Risposta migliore

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
Abbandona
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.

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
{{Hablar@Representante@Klm}} ¿Cómo llamar a KLM desde Panamá?
odooV8
Avatar
0
giu 26
93
How Odoo Is Revolutionizing Business Management?
odooV8
Avatar
0
giu 26
8
Hidden Odoo Features That Businesses Often Overlook?
odooV8
Avatar
0
giu 26
3
Helpful Odoo Resources
odooV8
Avatar
0
mag 26
1
Odoo Technical Stack
odooV8
Avatar
0
mag 26
5
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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