Re: [tryton] Create New Party Record

2016-05-25 Thread Sergi Almacellas Abellana

El 25/05/16 a les 13:18, Akshay patel ha escrit:


*I try to create a new party record as follow:*

{

"method": "model.party.party.create",

"params": [5, "02d34f6c010a46e4aab8a9deb4a12d17", {

"first_name": "p",

"name": "A"

}, {

"values": {

"first_name": "p",

"name": "A"

}

}]

}



The create method expects a list of dictionaries as explained in the docs[1]

I see you have a "values" dictionary which doest not seem correct, so 
the following parameters:


[{"first_name": "p","name": "A"}, {"first_name": "p","name": "A"}]

Will create two parties, with name A and first_name p.

Hope it helps!


[1] 
http://doc.tryton.org/4.0/trytond/doc/ref/models/models.html?highlight=create#trytond.model.ModelStorage.create



--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

--
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/5745B086.2070809%40koolpi.com.


[tryton] Create New Party Record

2016-05-25 Thread Akshay patel

*I try to create a new party record as follow:*

{

"method": "model.party.party.create",

"params": [5, "02d34f6c010a46e4aab8a9deb4a12d17", {

"first_name": "p",

"name": "A"

}, {

"values": {

"first_name": "p",

"name": "A"

}

}]

}


*But gives me ERROR as follow:*



{

  "id": 0,

  "error": [

"'unicode' object has no attribute 'copy'",

"Traceback (most recent call last):\n  File 
\"/trytond/protocols/wsgi/__init__.py\", line 55, in jsonrpc_app\n
response['result'] = dispatch(*args)\n  File 
\"/trytond/protocols/dispatcher.py\", line 158, in dispatch\nresult = 
rpc.result(meth(*c_args, **c_kwargs))\n  File 
\"/trytond/modules/party/party.py\", line 205, in create\nvlist = 
[x.copy() for x in vlist]\nAttributeError: 'unicode' object has no 
attribute 'copy'\n"

  ]

}


*Help me to solve this*

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/7a94cbe1-135a-43b3-8155-a6c3062d5faa%40googlegroups.com.