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
    • Approvazioni
    • 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

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È 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

Update product using REST API (JSON-RPC) ?

Iscriviti

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

La domanda è stata contrassegnata
updateapiwriterest
6 Risposte
48983 Visualizzazioni
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
Abbandona
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
Risposta migliore

hii

i solved this prob...

You are passing wrong string

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

2
Avatar
Abbandona
Randy Risser

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

Avatar
Santi
Risposta migliore

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
Abbandona
Avatar
Andreas Jonderko
Risposta migliore

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
Abbandona
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à
External API update / write method problem Risolto
external update api write
Avatar
Avatar
2
mar 25
2780
PHP error on records update
error update api php write
Avatar
Avatar
1
apr 18
4423
Update database field
wizard update write
Avatar
0
ott 24
189
How call an API when values change in DataBase? Risolto
postgresql api write
Avatar
Avatar
Avatar
3
mag 21
8870
OdooV13 Update a record Risolto
update api odooV13
Avatar
Avatar
1
nov 20
11120
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 ภาษาไทย 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