Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Intelligence artificielle
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
odooV8
2 Réponses
22679 Vues
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
Ignorer
Emmanuel Roldan
Auteur

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
Meilleure réponse

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
Ignorer
Avatar
Emmanuel Roldan
Auteur Meilleure réponse

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

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
{{Hablar@Representante@Klm}} ¿Cómo llamar a KLM desde Panamá?
odooV8
Avatar
0
juin 26
93
How Odoo Is Revolutionizing Business Management?
odooV8
Avatar
0
juin 26
8
Hidden Odoo Features That Businesses Often Overlook?
odooV8
Avatar
0
juin 26
3
Helpful Odoo Resources
odooV8
Avatar
0
mai 26
1
Odoo Technical Stack
odooV8
Avatar
0
mai 26
5
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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