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
    • Odobritve
    • 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
    • Estate 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č

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
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č

Update product using REST API (JSON-RPC) ?

Naroči se

Get notified when there's activity on this post

This question has been flagged
updateapiwriterest
6 Odgovori
49000 Prikazi
Avatar
Tillt

Hello,

I'm trying to update a product but I can't find the correct JSON structure to do it. Here is what I've tried:

{
    "jsonrpc": "2.0",
    "method": "call",
    "params": {
        "model": "product.product",
        "ids": [
            77
        ],
        "vals": {
            "name_template": "Coca-Cola 50cl OK"
        },
        "context": {},
        "session_id": "f48b00a031fc4920af0b3e4ec04d9497"
    },
    "id": "r6"
}

on this URL: /web/dataset/write

All my "search_read" requests are working normaly but I need your help for the "write" one.

Could you help me?

-- Edit ----------

When I enabled the debug-rpc log level I can see that:

2014-04-28 19:58:13,507 7104 INFO ? werkzeug: 127.0.0.1 - - [28/Apr/2014 19:58:13] "POST /web/dataset/write HTTP/1.1" 404 -

The URL for write data seems to be false... Does someone knows it ?

-- Edit ----------

I've tried to edit my product through OpenERP web interface to see the log...

2014-04-28 20:26:50,864 7104 DEBUG database openerp.netsvc.rpc.request: object.execute_kw time:0.373s mem: 49368k -> 49452k (diff: 84k)(u'database', 1, '*', u'product.product', 'write', (...), {...})
2014-04-28 20:26:51,012 7104 INFO database werkzeug: 127.0.0.1 - - [28/Apr/2014 20:26:51] "POST /web/dataset/call_kw HTTP/1.1" 200 -

It seems send the request at /web/dataset/call_kw so when I send my request to this URL I receive this answer:

2014-04-28 20:52:41,036 7104 ERROR database openerp.addons.web.http.JSONRequest.dispatch: An error occured while handling a json request
Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\http.py", line 204, in dispatch
TypeError: call_kw() got an unexpected keyword argument 'vals'
2014-04-28 20:52:41,184 7104 INFO database werkzeug: 127.0.0.1 - - [28/Apr/2014 20:52:41] "POST /web/dataset/call_kw HTTP/1.1" 200 -

An idea to solve my problem ?

Thanks.

1
Avatar
Opusti
Gaurav Sahu

Same problem..... Do you get any solution????

Gaurav Sahu

Same problem..... Do you get any solution????

Gaurav Sahu

hii i solve this prob... You are passing wrong string follow this link http://gauravsahu.github.io/odoo-client-JSON-RPC/

Avatar
Gaurav Sahu
Best Answer

hii

i solved this prob...

You are passing wrong string

follow this link
http://gauravsahu.github.io/odoo-client-JSON-RPC/

2
Avatar
Opusti
Randy Risser

Is there any way to convert this to google script code?

Avatar
Santi
Best Answer

Hi,

The params for /web/dataset/call_kw are incorrect. They should be (model, methods, args, kwargs).
I have made it work using angular-odoo, though this is not required. Here you can find how "call" should be implemented on RPC.

Angular Odoo. Inspect the following js for further information:
https://github.com/akretion/angular-odoo/blob/master/dist/odoo.js#L5

Params you need (data):

{
\"jsonrpc\":\"2.0\",
\"method\":\"call\",
\"params\":{
    \"model\":\"product.product\",
    \"method\":\"write\",
    \"args\":[[20],{\"name\":\"Best Product Evaaa\"}],
    \"kwargs\":{\"context\":{}}
    }
}

Example (angular-odoo):

jsonRpc.call(    
    "product.product",
    "write",
    [[20], {'name': "Best Product Evaaa"}]
).then(function(res){
     console.log(res); // true
}, function(err){
     console.log(err);
)
0
Avatar
Opusti
Avatar
Andreas Jonderko
Best Answer

You have to use the url for all your requests, follow the examples of Gaurav Sahu.

http://%s:%s/jsonrpc

In this file you will find more answers of possible calls: Odoo 8.0 (on Ubuntu 14.04) /usr/lib/python2.7/dist-packages/openerp/http.py

 

0
Avatar
Opusti
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
External API update / write method problem Solved
external update api write
Avatar
Avatar
2
mar. 25
2785
PHP error on records update
error update api php write
Avatar
Avatar
1
apr. 18
4424
Update database field
wizard update write
Avatar
0
okt. 24
189
How call an API when values change in DataBase? Solved
postgresql api write
Avatar
Avatar
Avatar
3
maj 21
8871
OdooV13 Update a record Solved
update api odooV13
Avatar
Avatar
1
nov. 20
11120
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 ภาษาไทย 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