IRC logs of #tryton for Tuesday, 2013-08-20 #tryton log beginning Tue Aug 20 00:00:01 CEST 2013
2013-08-20 08:38 -!- priyankarani(~priyanka@ has left #tryton
2013-08-20 10:33 <javivf> morning
2013-08-20 10:52 <jvblasco> morning everyone
2013-08-20 11:46 <jvblasco> guys, im having some issues trying to access tryton through JSONRPC interface. I am able to login and i get the uid and the login token (that's my guess), after that i don't really know what parameters are requiered to invoke methods from the jsonrpc client.
2013-08-20 11:47 <jvblasco> I'm trying to pass de uid and the token, but i don't really understand how it computes the request cause i always get errors
2013-08-20 11:47 <jvblasco> do i need to get the context first for that user or something im not counting on?
2013-08-20 11:48 <jvblasco> btw i'm trying to do it from PHP
2013-08-20 11:51 <jvblasco> i'm also trying to use the XML-RPC docs in the wiki as a reference, but they are for versiĆ³n 1.6
2013-08-20 11:59 <Pilou> jvblasco:
2013-08-20 12:05 <jvblasco> Pilou: thnx so much, that's what i'm doing but i don't seem to be able to retrieve the context through model.res.user.get_preferences params: uid, token, TRUE
2013-08-20 12:10 <Pilou> With some comments
2013-08-20 12:11 <Pilou> it's model.res.user.get_preferences(uid, cookie, True, {})
2013-08-20 12:13 <jvblasco> So the last parameter is an empty array?
2013-08-20 12:13 <Pilou> yes
2013-08-20 12:14 <jvblasco> so that in php should be and empty array like array()?
2013-08-20 12:15 <jvblasco> nah, array passes as a list that doesn't have the attribute copy
2013-08-20 12:15 <Pilou> it's an empty hash/dict
2013-08-20 12:15 <jvblasco> or so say's the error
2013-08-20 12:16 <jvblasco> Thnx so much Pilou, now i have something to keep working ;)
2013-08-20 12:24 <jvblasco> OMG i needed to solve it using: $context = $connection->sendRequest('model.res.user.get_preferences', array($uid, $token, TRUE, array(NULL => NULL)));
2013-08-20 12:25 <jvblasco> u need to fill 1 key-value pair in the php array to let it arrive to tryton as a dictionary, cause if u leave empty it arrives to tryton as a list not as a dictionary.
2013-08-20 12:26 <jvblasco> i really hate php xP
2013-08-20 13:09 <jvblasco> Here goes another one, how do i make methods on my own modules to be exposed in the JSON-RPC interface?
2013-08-20 13:10 <jvblasco> i try to execute a method in the helloworld module (the wiki example) named testJSON that only returns a string saying it works. As soon as i try to execute it as admin i get that response.
2013-08-20 13:11 <jvblasco> i tried to create a new goup granting all permissions to the model but the problem persists.
2013-08-20 13:12 <jvblasco> Sorry about asking too many questions but i can't find anything related to this in the documentation.
2013-08-20 13:51 <jvblasco> let me reformulate the question and simplify it, how do i make a module method executable from JSON-RPC? i'm not finding any clue anywhere about how to do it.
2013-08-20 13:51 <Pilou> jvblasco: about custom RPC calls, here is an example:
2013-08-20 14:05 <jvblasco> Pilou: Thnx so much for the, i lost the count, reply.
2013-08-20 14:21 <jvblasco> BTW this is the example module i'm using for the test: i updated with the info u provided and i still get the same error. Anything i'm missing?
2013-08-20 14:23 <vcardon> Hello, anybody knows if there are community modules that deal with hr (similar to hr, hr_expense, hr_holidays, hr_contract, hr_attendance in OERP) ?
2013-08-20 14:28 <Pilou> jvblasco: 1) replace "cls.__rpc__.update({'compute': RPC(),})" with "cls.__rpc__.update({'test_json': RPC(),})"
2013-08-20 14:28 <jvblasco> Pilou: My mistake, i think i more or less got it
2013-08-20 14:28 <jvblasco> Pilou: yeah, thnx so much anyway for the response
2013-08-20 14:29 <Pilou> jvblasco: 2) replace "def test_json (self):" with "@classmethod def test_json(cls):"
2013-08-20 14:29 <jvblasco> vcardon: I'm using for module checking. I don't really know any other place to look for it
2013-08-20 14:30 <jvblasco> vcardon: Anyway as far as i know i haven't really seen any HR module for tryton, maybe other ppl here knows more about it
2013-08-20 14:30 <jvblasco> Pilou: Thnx so much, trying...
2013-08-20 14:46 <jvblasco> Pilou: Mission accomplished, thnx ;)
2013-08-20 15:55 <vcardon> jvblasco: thanks, I had not been able to find anything HR, and third party modules seem somewhat scatered on the web (openlabs, zikzak, etc)
2013-08-20 16:54 <nicoe> vcardon: Usually we recommand the use of the Tryton category on pypi:
2013-08-20 16:59 <pokoli> vcardon: maybe ???
2013-08-20 17:06 <vcardon> nicoe: this is the best view so far on the available stock and 3rd party modules. The advantage is that it shows the description.
2013-08-20 17:08 <vcardon> pokoli: how is it that your module is not listed on nicoe's list ? Is there a procedure to follow to submit modules to be included there (peer review, etc) ?
2013-08-20 17:08 <pokoli> vcardon: it's not my module :P
2013-08-20 17:09 <pokoli> vcardon: because it's not published to pypi
2013-08-20 17:09 <pokoli> vcardon: don't know why, you must ask this to the mai developer :P
2013-08-20 17:15 <vcardon> Looks like there are also some nice stuff there on presik's site, thanks nicoe for pointing it to us. The new kids on the block like me need people to help them explore the tryton territory ;)
2013-08-20 17:18 <nicoe> vcardon: anybody can submit his package to pypi, I would not use a module that is not submitted there because making modules pip-installable display a good behavior towards to comunity (will to correctly package stuff, paying attention to releases and so on)
2013-08-20 17:19 <nicoe> But the fact that a module is there is not enough to mean that it's a good module, it's just a good start ;)
2013-08-20 17:32 <vcardon> yes, good point, and I agree with nicoe that a good packaging generally implies good coding. I've bookmarked your suggested references.
2013-08-20 19:54 <plantian> Is it possible to access the underlying integer id of a model? Like say product.template_id instead of product.template?
2013-08-20 20:05 -!- vcardon( has left #tryton
2013-08-20 20:28 <plantian> nevermind, I can just use raw SQL
2013-08-20 21:51 -!- yangoon_rm( has left #tryton
2013-08-20 22:18 <udono> plantian: hi, use
2013-08-20 22:22 <plantian> udono: Hi, I was trying to optimize a script so that the relation did not have to be loaded because it is in a loop executed many times, 3000+, so it takes a long time. Is it possible to load products with a relation in parallel without needing to load the relation on each product individually?
2013-08-20 22:27 <udono> plantian: maybe the is quick enough?
2013-08-20 22:39 <plantian> udono: yes maybe that would be better, I can just get the template ids of the products with that? template_id_by_product_id = search_read(my_product_domain, field_names=['template'])
2013-08-20 22:40 <udono> plantian: I'm not sure with the use.
2013-08-20 22:59 <plantian> udono: okay thanks, I will try it out
2013-08-20 22:59 <plantian> Is there a place with more recent examples (2.8) of calling trytond with xmlrpc -- ?
2013-08-20 23:02 <plantian> nevermind, I guess I don't understand how user permissions work, seems that I have to be admin

Generated by 2.17.3 by Marius Gedminas - find it at!