-
FA1989
-
-
Offline
-
Fresh Boarder
-
- Messaggi: 19
- Ringraziamenti ricevuti 1
-
Karma: 0
-
|
Ciao a tutti,
sto cercando di collegare il mio ecommerce (custom) con odoo per inserire automaticamente gli ordini.
Inizio con la creazione di un res.partner, ma ottengo uno strano errore.
Questo è il mio codice:
$countryRes = $odoo->execute_kw($db, $uid, $password,'res.country', 'search_read',
array(array(array('name', 'like', 'Italy'))), array('fields' => ''));
$name = "Luigi Pinetti";
$is_company = false;
$company_name = "";
$customer = true;
$email = "luigi.pinetti@gmail.com";
$phone = "0301234567";
$street = "Via casa mia 12";
$street2 = "Appartamento 1/C";
$city = "Brescia";
$country_id = $countryRes[0];
$notify_email = 0;
$invoice_warn = 0;
$id = $odoo->execute_kw($db, $uid, $password, 'res.partner', 'create', array(array('name'=>$name,'is_company'=>$is_company,'company_name'=>$company_name,'customer'=>$customer,'email'=>$email,'phone'=>$phone,'street'=>$street,'street2'=>$street2,'city'=>$city,'country_id'=>$country_id,'notify_email'=>$notify_email,'invoice_warn'=>$invoice_warn)));
print_r($id);
e ottengo questo:
Array ( [faultCode] => 1 [faultString] => Traceback (most recent call last): File "/opt/odoo-te/odoo/service/wsgi_server.py", line 56, in xmlrpc_return result = odoo.http.dispatch_rpc(service, method, params) File "/opt/odoo-te/odoo/http.py", line 118, in dispatch_rpc result = dispatch(method, params) File "/opt/odoo-te/odoo/service/model.py", line 38, in dispatch res = fn(db, uid, *params) File "/opt/odoo-te/odoo/service/model.py", line 157, in execute_kw return execute(db, uid, obj, method, *args, **kw or {}) File "/opt/odoo-te/odoo/service/model.py", line 101, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo-te/odoo/service/model.py", line 164, in execute res = execute_cr(cr, uid, obj, method, *args, **kw) File "/opt/odoo-te/odoo/service/model.py", line 153, in execute_cr return odoo.api.call_kw(recs, method, args, kw) File "/opt/odoo-te/odoo/api.py", line 687, in call_kw return call_kw_model(method, model, args, kwargs) File "/opt/odoo-te/odoo/api.py", line 672, in call_kw_model result = method(recs, *args, **kwargs) File "/opt/odoo-te/odoo/addons/base/res/res_partner.py", line 532, in create partner = super(Partner, self).create(vals) File "/opt/odoo-te/addons/mail/models/mail_thread.py", line 228, in create thread = super(MailThread, self).create(values) File "/opt/odoo-te/addons/component_event/models/base.py", line 93, in create record = super(Base, self).create(vals) File "/opt/odoo-te/odoo/models.py", line 3823, in create record = self.browse(self._create(old_vals)) File "/opt/odoo-te/odoo/models.py", line 3918, in _create cr.execute(query, tuple(u[2] for u in updates if len(u) > 2)) File "/opt/odoo-te/odoo/sql_db.py", line 154, in wrapper return f(self, *args, **kwargs) File "/opt/odoo-te/odoo/sql_db.py", line 231, in execute res = self._obj.execute(query, params) ProgrammingError: can't adapt type 'dict' )
Non riesco proprio a risolvere. Potete aiutarmi?
Grazie!
|