Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

sample of write please #7

Open
vitucris opened this issue May 21, 2021 · 3 comments
Open

sample of write please #7

vitucris opened this issue May 21, 2021 · 3 comments
Labels
odoo odoo related

Comments

@vitucris
Copy link

Hi I have following lines of code

var dict = XmlRpcParameter.EmptyStruct();                            
dict = XmlRpcParameter.AsStruct(XmlRpcParameter.AsMember("state", "done"));
var parameters = XmlRpcParameter.AsArray(dict);
                            
client.Rpc.Path = "xmlrpc/2/object";
XmlRpcRequest request = new XmlRpcRequest("execute_kw");
var objToUpdate = XmlRpcParameter.AsArray(XmlRpcParameter.AsArray(id),parameters);
request.AddParams(client.DbName, client.UserId, client.DbPwd, "stock.picking", "write", objToUpdate);
response = client.Rpc.Execute(request);

The error is:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/controllers/rpc.py", line 69, in xmlrpc_2
    response = self._xmlrpc(service)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/controllers/rpc.py", line 49, in _xmlrpc
    result = dispatch_rpc(service, method, params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 139, in dispatch_rpc
    result = dispatch(method, params)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 41, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 174, in execute_kw
    return execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 181, in execute
    res = execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 165, in execute_cr
    result = odoo.api.call_kw(recs, method, args, kw)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 387, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 374, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/stock/models/stock_picking.py", line 594, in write
    if vals.get('picking_type_id') and self.state != 'draft':
AttributeError: 'list' object has no attribute 'get'
@sauljabin sauljabin added the odoo odoo related label Aug 3, 2022
@sauljabin
Copy link
Owner

@fjarboleda-lm any thoughts on this?

@fjarboleda
Copy link

I think you are set an empty stock pickinc into done. Maybe you should add lines and quantities to the draft before mover to done.
Anyway It is openErp logic. Tryp do It into the app.

@fjarboleda
Copy link

An adición, entre of stock and stock línes shoud filled location_id and location_dest_id. It means the source and destination of warehouse.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
odoo odoo related
Projects
None yet
Development

No branches or pull requests

3 participants