Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Update product using REST API (JSON-RPC) ?

Odoberať

Get notified when there's activity on this post

This question has been flagged
updateapiwriterest
6 Replies
48972 Zobrazenia
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
Zrušiť
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
Zrušiť
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
Zrušiť
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
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
External API update / write method problem Solved
external update api write
Avatar
Avatar
2
mar 25
2777
PHP error on records update
error update api php write
Avatar
Avatar
1
apr 18
4420
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
máj 21
8867
OdooV13 Update a record Solved
update api odooV13
Avatar
Avatar
1
nov 20
11118
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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