IRC logs of #tryton for Monday, 2013-07-08

chat.freenode.net #tryton log beginning Mon Jul 8 00:00:03 CEST 2013
2013-07-08 11:25 <giedrius> hi cedk
2013-07-08 11:26 <giedrius> cedk: could you give an example how to set context in scenario of review970002?
2013-07-08 11:27 <cedk> giedrius: you can't on instance method
2013-07-08 11:29 <cedk> giedrius: so I'm not sure instance method is really needed there
2013-07-08 11:29 <cedk> giedrius: but otherwise context should not be set because it is useless
2013-07-08 11:30 <giedrius> cedk: i can move the implementation from class method to instance
2013-07-08 11:30 <giedrius> cedk: then it would be possible to have both methods working
2013-07-08 11:32 <cedk> giedrius: it is a possibility but it will be good to see if in the current code the instance method could be used
2013-07-08 11:35 <giedrius> cedk: it can be used in many places, see grep -ir "currency.compute" trytond/modules
2013-07-08 11:37 <giedrius> cedk: it is basically the same as with Uom.convert
2013-07-08 11:38 <cedk> giedrius: no because of the context
2013-07-08 11:39 <giedrius> cedk: even it's better because current interface to convert quantity is not simple, you need to set context..
2013-07-08 11:39 <giedrius> i mean currency
2013-07-08 11:39 <cedk> giedrius: I think you always have to set the context so better to have an interface that force the user to think about it
2013-07-08 11:40 <giedrius> cedk: i don't understand, why context is better than method argument?
2013-07-08 11:44 <cedk> giedrius: a method argument will be good also
2013-07-08 11:47 <giedrius> cedk: as i understand, the context is used more for passing around the common data (not specific for single model), like user_id, company_id, etc..
2013-07-08 11:48 <cedk> giedrius: context is used here because rate fields is a Function field that uses context
2013-07-08 11:49 <cedk> giedrius: but I guess it could be a good improvement to pass the date as argument to avoid to have to set the context before calling compute
2013-07-08 11:53 <giedrius> cedk: alright, i'll work on the patch

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!