IRC logs of #tryton for Wednesday, 2013-08-21 #tryton log beginning Wed Aug 21 00:00:02 CEST 2013
2013-08-21 08:05 -!- priyankarani(~priyanka@ has left #tryton
2013-08-21 09:10 -!- vcardon( has left #tryton
2013-08-21 11:23 <jvblasco> morning everyone
2013-08-21 11:24 <sisalp2> jvblasco: hi
2013-08-21 15:50 <b0r7> i want to add the usernam of the current logged in user to a report, but having trouble finding the model that is porviding it. The username (full: Name and Surname) is schon (e.g.) on the bottom left of the Client.. could one maybee point me in the right direction? grepping for 'username' resulted in a lot of 'rpc' stuff
2013-08-21 15:53 <b0r7> ah.. res.user is it, i think..
2013-08-21 15:56 <jvblasco> depends
2013-08-21 15:56 <jvblasco> u mean u want to use the user name of the user generating the report?
2013-08-21 15:56 <b0r7> jvblasco: yes
2013-08-21 15:57 <jvblasco> and yeah, the user is the res.user model
2013-08-21 15:57 <jvblasco> then u have to retrieve it from the transaction/context
2013-08-21 15:57 <jvblasco> later on get the model with the Pooler, make a search_read with the criteria u got from the context/transaction
2013-08-21 15:57 <jvblasco> and there u go
2013-08-21 15:58 <jvblasco> anyway i'm not really an expert in tryton. I know openERP passes the username in the context
2013-08-21 15:58 <jvblasco> but i think in tryton u can retrieve it from the transaction object
2013-08-21 15:59 <b0r7> uff okay.. sounds complicated.. i guess im going to find out thanks for the pointers!
2013-08-21 15:59 <jvblasco> gimme a sec to check if i can find a code example
2013-08-21 16:00 <jvblasco> let's see if i can simplify it a little
2013-08-21 16:00 <jvblasco> anyway i may be wrong, but there it goes
2013-08-21 16:01 <jvblasco> if u import the Transaction module
2013-08-21 16:01 <b0r7> nod
2013-08-21 16:01 <jvblasco> u should be able to do something like Transaction().context.get('user')
2013-08-21 16:01 <jvblasco> maybe it's uid and not user, didn't need to work with that
2013-08-21 16:02 <jvblasco> that should return the uid or the username doing that transaction
2013-08-21 16:02 <jvblasco> from there
2013-08-21 16:02 <jvblasco> u just need to retrieve the object through the ORM
2013-08-21 16:04 <jvblasco> gimme a sec, i need to document myself, still haven't worked hard with the ORM so i still don't know everything it is capable of
2013-08-21 16:05 <jvblasco> ok
2013-08-21 16:05 <jvblasco> later on u retrieve the model with the Pooler
2013-08-21 16:05 <b0r7> Transaction().user gives me the uid..
2013-08-21 16:06 <jvblasco> Pool.get(res.user)รง
2013-08-21 16:06 <jvblasco> user = Pool.get('res.user')
2013-08-21 16:06 <jvblasco> after that u only need to do a search_read
2013-08-21 16:07 <jvblasco> user.search_read(Don't really know the how are the params passed)
2013-08-21 16:07 <jvblasco> but u can find it in
2013-08-21 16:07 <jvblasco> that would be the way to do it i know
2013-08-21 16:07 <jvblasco> maybe there's a better one
2013-08-21 16:08 <jvblasco> but that's the one i can come with ;)
2013-08-21 16:08 <jvblasco> hope it helped
2013-08-21 16:08 <b0r7> oaky.. that is extremely helpful.. i need some time to work it out, though ;).. thanks a lot
2013-08-21 16:08 <jvblasco> np
2013-08-21 16:10 <albertca> In fact you should:
2013-08-21 16:10 <albertca> User = Pool().get('res.user') # Note the parenthesis after Pool
2013-08-21 16:11 <jvblasco> yeah, i come from openERP and still learning tryton
2013-08-21 16:11 <albertca> user = User(Transaction().user) # Now you have the object of the user
2013-08-21 16:11 <albertca> jvblasco: most of us come from openerp
2013-08-21 16:11 <albertca> jvblasco: :)
2013-08-21 16:12 <jvblasco> albertca: yeah, i know. Anyway i'm falling in love with this framework. Much better implementations in many places
2013-08-21 16:12 <albertca> jvblasco: yes...
2013-08-21 16:12 <albertca> b0r7: no need for search_read
2013-08-21 16:12 <jvblasco> albertca: and the most important thing, it's simpler to generate code here
2013-08-21 16:19 <b0r7> Pool().get('res.user') leads to an error , stating: database_name = Transaction().cursor.database_name 'NoneType' object has no attribute 'database_name'
2013-08-21 16:25 <albertca> b0r7: Mm... I don't have experience with relatorio reports. The expression I provided was if doing a normal module
2013-08-21 16:26 <albertca> b0r7: I'd say you should have examples in the code, though
2013-08-21 16:27 <b0r7> yeah.. i think im getting there..
2013-08-21 16:27 <jvblasco> best time investment u'll do
2013-08-21 16:28 <jvblasco> looking in the code > most things to some extent xD
2013-08-21 16:29 <cedk> b0r7: you are probably outside of a transaction
2013-08-21 17:01 <jvblasco> guys, is there any how to about generating documentation? Are there any "standards" to generate it?
2013-08-21 17:06 <cedk> jvblasco: make html or
2013-08-21 17:14 <jvblasco> cedk: mmmmmm, too many things to do and really little time. Anyway i meant howto type documentation. For example, generate tutorials for JSON-RPC
2013-08-21 17:15 <jvblasco> cedk: I had some issues communicating php tryton via JSON- RPC and was thinking about generating some how to documentation to achieve that
2013-08-21 17:17 <jvblasco> cedk: i try to generate it for internal wikis and that kind of stuff, but wanted to know if u have any standard to do it, to save time and generate it only once.
2013-08-21 17:18 <cedk> jvblasco: I don't understand
2013-08-21 17:19 <jvblasco> cedk: when i solve a problem, and if time allows me to do it, i try to generate how to documentation about how that specific thing works. Later on i add it to an internal wiki we have in the enterprise
2013-08-21 17:20 <jvblasco> cedk: i just wanted to know if there are any standards about generating that kind of documentation to add it to the tryton wiki as soon as the doc is finished
2013-08-21 17:21 <jvblasco> cedk: excuse my english...
2013-08-21 17:21 <jvblasco> cedk: not sure if i clarified anything
2013-08-21 17:22 <cedk> jvblasco: we use rst
2013-08-21 17:23 <jvblasco> cedk: ok
2013-08-21 17:23 <jvblasco> cedk: if i have time to generate in spanish, i will try to translate it to english to upload it to the wiki
2013-08-21 17:34 <Pilou> jvblasco: It is better to patch the documentation than to update the wiki.
2013-08-21 17:36 <cedk> Pilou, jvblasco: but doc about PHP code will not be included in base
2013-08-21 17:37 <Pilou> jvblasco: yep documentation not considered useful by cedk will be rejected
2013-08-21 17:41 <jvblasco> cedk, Pilou: good to know
2013-08-21 17:43 <Pilou> so you could update the wiki :)
2013-08-21 17:43 <jvblasco> May i ask how do u delete Products, Party or Carriers from the client?
2013-08-21 17:45 <jvblasco> Pilou, cedk: anyway if i can spend the time to generate it someday i will let u know or whatever. If u find it useful i'm sure u will know what to do with it :)
2013-08-21 18:23 <plantian> if read is not ordered is it just expected that client re-sorts the results based on the ids returned from search?
2013-08-21 18:24 <cedk> plantian: yes because client create records before reading them
2013-08-21 18:25 <plantian> cedk: okay thanks
2013-08-21 18:51 -!- vcardon( has left #tryton
2013-08-21 22:41 -!- katr( has left #tryton

Generated by 2.17.3 by Marius Gedminas - find it at!