Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Artificial Intelligence
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Property Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
odooV8
2 Odgovori
22691 Prikazi
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
Opusti
Emmanuel Roldan
Avtor

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
Opusti
Avatar
Emmanuel Roldan
Avtor 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
Opusti
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!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
{{Hablar@Representante@Klm}} ¿Cómo llamar a KLM desde Panamá?
odooV8
Avatar
0
jun. 26
93
How Odoo Is Revolutionizing Business Management?
odooV8
Avatar
0
jun. 26
8
Hidden Odoo Features That Businesses Often Overlook?
odooV8
Avatar
0
jun. 26
3
Helpful Odoo Resources
odooV8
Avatar
0
maj 26
1
Odoo Technical Stack
odooV8
Avatar
0
maj 26
5
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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