IRC logs of #tryton for Friday, 2013-11-15

chat.freenode.net #tryton log beginning Fri Nov 15 00:00:02 CET 2013
pokoliHi, i have two views on the same model with diferent contexts. Is possible to disable the create option on the client depending on the context?13:06
pokolis/view/action/13:06
pokoliSo you can create records from one action and you don't from the other13:06
jvblascoi think i'm having some troubles with contexts too, but they are a great unkown for me13:25
jvblascoi don't think i can help on that sry13:25
pokolijvblasco: I can try helping on your troubles13:27
jvblascopokoli: i'm trying to generalize the carrier_grid module i presented in the TUB13:33
jvblascopokoli: the problem is that when onchange_carrier is called (with sale_shipment_cost module installed) the method _get_carrier_context is called too in the sale.sale model13:35
cedkpokoli: no13:36
jvblascopokoli: but as i try to access the resource variables it throws an error that they don't exist, i've checked the resource id and it says none, but i can access some resources13:36
jvblascopokoli: but i don't know why13:37
cedkjvblasco: you have to define in the on_change list all the fields you will access in your method13:37
pokolicedk: I imagined that wasn't possible so I managed to do in another way. Thanks!13:38
cedkpokoli: access right should not depend on the context13:38
cedkpokoli: indeed depending on context should always tried to be avoid13:39
jvblascocedk: i c, how do i overload that then?13:39
cedkjvblasco: you can in __setup__ method13:39
jvblascocedk: any code i can check to learn how to do it?13:40
cedkjvblasco: but I fill an issue to improve that: https://bugs.tryton.org/issue348713:40
cedkjvblasco: http://hg.tryton.org/modules/sale_shipment_cost/file/e32344abde19/sale.py#l5013:43
jvblascocedk: thnx so much13:44
jvblascocedk: solved, thnx so much, btw may i ask what does the second for exactly do? I understand the first for, it's very straightforward, but i cannot figure out the second one13:59
cedkjvblasco: it is to sync both on_change because on_change_carrier calls on_change_lines14:01
jvblascocedk: so, if u have an onchange chain call, like this one, right now one must synchronize all the onchange methods that way and add a for loop for every onchange method called?14:05
cedkjvblasco: yes14:47
cedkjvblasco: but it is something that you should try to avoid14:47
jvblascocedk: ok, thnx15:15
pokoliHi, when an exception is thrown, all the entire transaction is rolled back, isn't it?16:52
pokoliSo what i have to do if I want to save some value in the database?16:52
jvblascopokoli: may not be the best idea, but catching the exception and creating a register to save the data?16:57
pokolijvblasco: yes but the register is not saved, as the transaction is rolled back :)16:57
pokoliso I'm trying to start another transaction16:57
jvblascopokoli: that's what i mean, in the catch block, create another transaction and save the data u need16:58
jvblascopokoli: not sure how catch block is called in python16:58
pokolijvblasco: that's what amb trying :)16:58
jvblascopokoli: anyway, are u saving the data just for later use?16:59
jeancavallopokoli: I already did that somewhere, for logging the rule engine I showed at the tub16:59
jeancavallopokoli: But you got to be extra careful in your transaction management16:59
pokolijeancavallo: that's why i'm asking, because I have to be very carefull.17:00
jeancavallopokoli: If what you are writing in the new cursor has references to instances which where modified in the source transaction, it might save them as well17:01
jeancavallopokoli: (Don't know if I am clear enough)17:01
jvblascopokoli: i haven't worked with transactions to that lvl yet, i wouldn't recommend my own help lol17:01
jeancavallopokoli: Base is : with Transaction().new_cursor():17:01
pokolijeancavallo: so I must avoid using self.save and prefer using cls.write?17:02
jeancavallopokoli: Only way to be sure is to avoid writing relation fields17:02
pokolijeancavallo: I want to write a char field, so I may use cls.write better than self.save()17:02
pokolijeancavallo: thanks for your tips, very usefull!17:02
jeancavallopokoli: Not what I meant. If you create a new instance, which has a M2O toward a field which is already updated in your 'main' transaction (which will be rollbacked), you're screwed17:03
pokoliACTION had written all the code in the wrong way 17:03
jeancavallopokoli: You may be abnle to manage with setting an id rather than a brwose object, but I am not sure17:03
pokolijeancavallo: I understood :) give me some time to try it :P17:04
jeancavallopokoli: Anyway, you should find a better way if it exists, like logging, etc...17:04
pokolijeancavallo: It's for the babi module, as calculations are done in background, i need to store if the calculation has some errors or is still calculating :P17:05
cedkpokoli: transactional database are not very good for that17:06
pokolicedk: I'm sure that they aren't17:06
jvblascohow about maybe using another database backend for all the calculation process, and dumping it when finished and checked to the transactional one?17:07
cedkpokoli: why not link with a task manager? And for example, celery :-)17:07
jeancavallopokoli: http://pastebin.com/YwnNZYcT , some ort of example17:08
pokolijeancavallo: thanks!17:09
pokolicedk: because celery uses and external database to write results and I would need to write a bunch of code to addapt their results to be displayed on tryton client17:10
pokolicedk: we're using http://codereview.tryton.org/685003/ :P17:10
pokolicedk: there is some plan to release it?17:11
jeancavallopokoli: It's a quick copy paste from our source, but it is some sort of logging in case of error (we are in an Except block, exc line 12 is the traceback we extracted)17:11
cedkpokoli: indeed, I don't know exactly where to put it17:11
cedkpokoli: I don't think its place is on tryton.org17:11
cedkpokoli: so probably I will have to create a google host project17:12
pokolicedk: or maybe you can create a github account :)17:13
pokoliACTION just kidding17:13
cedkpokoli: about external DB to write result that exactly why it is good in your cases because you are not link to the tryton transaction17:13
pokolicedk: way not realeasing on tryton.org as done with proteus?17:13
pokolicedk: you may need the same schema versioning17:13
pokolicedk: as some changes on the api may cause errors on trytond_celery17:14
pokolicedk: about external DB. I know you're absolutily right, I will try to improve it some day :)17:14
cedkpokoli: about versioning, yes but I don't think it is enough to be part of the standard17:17
cedkpokoli: most usage of Tryton will not require this tool17:17
cedkand even, others “connection” will be developped in the furture and I don't think we should host all of them17:17
pokolicedk: agree but it's an extension to the tryton framework so can be hold be the tryton foundation17:18
pokolicedk: same as offical modules and community one's17:18
pokolijeancavallo: You have a except DatabaseOperationError next to the commit?? To rollback if errors on database?17:19
jeancavallopokoli: It is handled "above"17:19
pokolijeancavallo: you mean in the with statement?17:20
jeancavallopokoli: Almost sure of it17:20
jeancavallopokoli: But indeed I should check :)17:20
pokoliACTION has locked the database :____(17:21
cedkpokoli: foundation doesn't have yet the ressource to hosts external project17:22
jeancavallopokoli: Oops...17:22
jeancavallopokoli: Looks like it is not handled properly. Did not bother me because I had no problem in this code, but thanks for pointing out17:23
pokolijeancavallo: just pointed it for helping you. No problem.17:24
pokolicedk: So i think a google code would be a great pleace17:25
jeancavallopokoli: <ninja>github</ninja>17:25
jvblascoguys may i ask what may be the TODO file format?17:25
pokolicedk: IMHO the important think is to have it available on pypi17:26
cedkpokoli: of course17:26
martinguzmanHi all! Is there a way to know the ip or mac address that a user is using to be connected?19:07
cedkmartinguzman: it is logged by trytond on login19:12
martinguzmancedk, but how can I get that info? (on a Wizard, for example)19:13
cedkmartinguzman: you can't19:17
martinguzmancedk: ok! Thanks19:20
-!- vcardon(~vcardon@LNeuilly-152-23-15-185.w193-252.abo.wanadoo.fr) has left #tryton19:55
-!- pablovannini(~pablo@181.47.181.28) has left #tryton22:25
hellhoundI'm currently implementing a web client for trytond and recently stumbled on something that seems weird on the ir.ui.menu model, apparently the parameter name in the get_action() method isn't being used22:51
hellhoundyou can see what I'm talking about on this pastie http://pastie.org/848357322:52
plantianhellhound: I think that is because it is a function field.  In order to use the same functions for multiple function fields that param exists, but if you just have 1 to 1 between the functions and the function field then the field name is assumed.23:23

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!