IRC logs of #tryton for Tuesday, 2013-08-20 #tryton log beginning Tue Aug 20 00:00:01 CEST 2013
-!- priyankarani(~priyanka@ has left #tryton08:38
jvblascomorning everyone10:52
jvblascoguys, 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.11:46
jvblascoI'm trying to pass de uid and the token, but i don't really understand how it computes the request cause i always get errors11:47
jvblascodo i need to get the context first for that user or something im not counting on?11:47
jvblascobtw i'm trying to do it from PHP11:48
jvblascoi'm also trying to use the XML-RPC docs in the wiki as a reference, but they are for versiĆ³n 1.611:51
jvblascoPilou: 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, TRUE12:05
PilouWith some comments
Pilouit's model.res.user.get_preferences(uid, cookie, True, {})12:11
jvblascoSo the last parameter is an empty array?12:13
jvblascoso that in php should be and empty array like array()?12:14
jvblasconah, array passes as a list that doesn't have the attribute copy12:15
Pilouit's an empty hash/dict12:15
jvblascoor so say's the error12:15
jvblascoThnx so much Pilou, now i have something to keep working ;)12:16
jvblascoOMG i needed to solve it using: $context = $connection->sendRequest('model.res.user.get_preferences', array($uid, $token, TRUE, array(NULL => NULL)));12:24
jvblascou 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.12:25
jvblascoi really hate php xP12:26
jvblascoHere goes another one, how do i make methods on my own modules to be exposed in the JSON-RPC interface?13:09
jvblascoi 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.13:10
jvblascoi tried to create a new goup granting all permissions to the model but the problem persists.13:11
jvblascoSorry about asking too many questions but i can't find anything related to this in the documentation.13:12
jvblascolet 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.13:51
Piloujvblasco: about custom RPC calls, here is an example:
jvblascoPilou: Thnx so much for the, i lost the count, reply.14:05
jvblascoBTW 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?14:21
vcardonHello, anybody knows if there are community modules that deal with hr (similar to hr, hr_expense, hr_holidays, hr_contract, hr_attendance in OERP) ?14:23
Piloujvblasco: 1) replace "cls.__rpc__.update({'compute': RPC(),})" with "cls.__rpc__.update({'test_json': RPC(),})"14:28
jvblascoPilou: My mistake, i think i more or less got it14:28
jvblascoPilou: yeah, thnx so much anyway for the response14:28
Piloujvblasco: 2) replace "def test_json (self):" with "@classmethod def test_json(cls):"14:29
jvblascovcardon: I'm using for module checking. I don't really know any other place to look for it14:29
jvblascovcardon: Anyway as far as i know i haven't really seen any HR module for tryton, maybe other ppl here knows more about it14:30
jvblascoPilou: Thnx so much, trying...14:30
jvblascoPilou: Mission accomplished, thnx ;)14:46
vcardonjvblasco: thanks, I had not been able to find anything HR, and third party modules seem somewhat scatered on the web (openlabs, zikzak, etc)15:55
nicoevcardon: Usually we recommand the use of the Tryton category on pypi:
pokolivcardon: maybe ???16:59
vcardonnicoe: this is the best view so far on the available stock and 3rd party modules. The advantage is that it shows the description.17:06
vcardonpokoli: 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) ?17:08
pokolivcardon: it's not my module :P17:08
pokolivcardon: because it's not published to pypi17:09
pokolivcardon: don't know why, you must ask this to the mai developer :P17:09
vcardonLooks 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 ;)17:15
nicoevcardon: 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)17:18
nicoeBut the fact that a module is there is not enough to mean that it's a good module, it's just a good start ;)17:19
vcardonyes, good point, and I agree with nicoe that a good packaging generally implies good coding. I've bookmarked your suggested references.17:32
plantianIs it possible to access the underlying integer id of a model?  Like say product.template_id instead of product.template?19:54
-!- vcardon( has left #tryton20:05
plantiannevermind, I can just use raw SQL20:28
-!- yangoon_rm( has left #tryton21:51
udonoplantian: hi, use product.template.id22:18
plantianudono: 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?22:22
udonoplantian: maybe the is quick enough?22:27
plantianudono: 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'])22:39
udonoplantian: I'm not sure with the use.22:40
plantianudono: okay thanks, I will try it out22:59
plantianIs there a place with more recent examples (2.8) of calling trytond with xmlrpc -- ?
plantiannevermind, I guess I don't understand how user permissions work, seems that I have to be admin23:02

Generated by 2.11.0 by Marius Gedminas - find it at!