IRC logs of #tryton for Thursday, 2017-04-27

chat.freenode.net #tryton log beginning Thu Apr 27 00:00:01 CEST 2017
2017-04-27 00:39 -!- JosDzG(~Thunderbi@189.250.122.148) has joined #tryton
2017-04-27 01:15 -!- JanGB(~jan@dslb-088-073-244-178.088.073.pools.vodafone-ip.de) has joined #tryton
2017-04-27 01:32 -!- JosDzG(~Thunderbi@189.250.122.148) has joined #tryton
2017-04-27 02:24 -!- csotelo(~csotelo@179.7.36.250) has joined #tryton
2017-04-27 03:39 -!- csotelo(~csotelo@179.7.36.250) has joined #tryton
2017-04-27 03:42 -!- iscadrian(440ca59b@gateway/web/freenode/ip.68.12.165.155) has joined #tryton
2017-04-27 03:47 <iscadrian> Hello. I downloaded the tryton source code, but the trytond.config is not present. Is it something I have to create by myself?
2017-04-27 04:54 -!- VaticanCameos(~VaticanCa@182.77.114.115) has joined #tryton
2017-04-27 04:55 -!- thaneor(~ldlc6@r179-24-156-43.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-04-27 05:58 <iscadrian> which Tryton client is compatible with Trytond 4.2?
2017-04-27 08:02 -!- JanGB(~jan@business-178-015-079-061.static.arcor-ip.net) has joined #tryton
2017-04-27 08:41 -!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton
2017-04-27 08:42 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton
2017-04-27 08:51 -!- dmollerm(~dmollerm@170.red-80-28-119.adsl.static.ccgg.telefonica.net) has joined #tryton
2017-04-27 08:58 -!- mrichez(~smuxi@mail.saluc.com) has joined #tryton
2017-04-27 09:12 -!- rpit(~rpit@aftr-37-24-151-117.unity-media.net) has joined #tryton
2017-04-27 10:50 -!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton
2017-04-27 11:49 -!- Telesight(~anthony@4dae0c97.ftth.telfortglasvezel.nl) has joined #tryton
2017-04-27 12:06 -!- piyush_(0116a082@gateway/web/freenode/ip.1.22.160.130) has joined #tryton
2017-04-27 12:06 <piyush_> hello I am getting some error "'int' object has no attribute '__getitem__'"
2017-04-27 12:11 <pokoli> piyush_: where? on a module? on proteus?
2017-04-27 12:12 <piyush_> while creating new sale
2017-04-27 12:14 <piyush_> I am sending "taxes" : (taxID) in request
2017-04-27 12:14 <piyush_> may be this cause problem?
2017-04-27 12:23 <pokoli> piyush_: can you post the full traceback?
2017-04-27 12:23 <pokoli> piyush_: please use som paste service (i.e: pastebin.com)
2017-04-27 12:25 <piyush_> thank you pokoli I got my error
2017-04-27 12:48 -!- mariomop(~quassel@190.30.187.82) has joined #tryton
2017-04-27 14:09 -!- uha4(~uha4@146.0.99.188) has joined #tryton
2017-04-27 14:10 <uha4> hello, can anyone tell me, how i can access the original (not translated) value of a field?
2017-04-27 14:11 <uha4> i want to check in my module, if a product.template is in a specific category. But if the category.name is translated, it should be recogised anyway
2017-04-27 14:12 <uha4> is there a way to access the untranslated value?
2017-04-27 14:14 <pokoli> uha4: you can change the translation language by using the language key on the context
2017-04-27 14:14 <pokoli> uha4: so just use yout "original language" code to access it
2017-04-27 14:15 <pokoli> uha4: something like: http://hg.tryton.org/trytond/file/764d4f9698d0/trytond/ir/translation.py#l502
2017-04-27 14:17 <uha4> i tried using 'with Transaction().set_context(language=u'en'): ', but still got the translated value
2017-04-27 14:18 <pokoli> uha4: you have to re-browse the record to get the correct translation
2017-04-27 14:18 <pokoli> uha4: have you checked with the client that english do not contain the translation value?
2017-04-27 14:18 <uha4> ok, thanks.
2017-04-27 14:20 <uha4> is there a faster/simpler way than "Pool().get('product.category')(id).name" ?
2017-04-27 14:20 <uha4> i would like to use it in a on_change_with method, so it's called quite often...
2017-04-27 14:20 <pokoli> uha4: there is a cache for translations
2017-04-27 14:21 <pokoli> uha4: can I ask for what are you trying to implement?
2017-04-27 14:25 <uha4> pokoli: I have some product properties that are only relevant for food products. So i created a category 'food' in product.xml of my module. and want to hide or require some fields dependend of product category.
2017-04-27 14:26 <pokoli> uha4: use the xml_id for this record with ir.model.data
2017-04-27 14:26 <pokoli> a domain like: ('category', '=', Id('your_module', 'xml_id_of_food_category')) will do the trick
2017-04-27 14:26 <uha4> pokoli: in the template i created a field.Function(field.Boolean)) that is updated checking the categories
2017-04-27 14:27 <pokoli> uha4: if you only need for pyson, there is no need of function field
2017-04-27 14:27 <pokoli> uha4: see http://doc.tryton.org/4.2/trytond/doc/ref/pyson.html?highlight=id#trytond.pyson.Id
2017-04-27 14:29 <uha4> pokoli: thanks, never heard of this...
2017-04-27 14:30 -!- csotelo(~csotelo@179.7.36.250) has joined #tryton
2017-04-27 14:30 <pokoli> uha4: when you create a record via xml, a mapping between id and db_id is stored on the ir.model.data table, so you always refer (from server or from pyson) to records created via xml
2017-04-27 14:30 -!- JanGB(~jan@business-178-015-079-061.static.arcor-ip.net) has joined #tryton
2017-04-27 14:31 <uha4> pokoli: i think i need the function field, as template.categories is many to many, and any of the categories could be a child of 'food_category'
2017-04-27 14:32 <uha4> pokoli: i also want to be able to do things like "if lot.product.food: "
2017-04-27 14:32 <pokoli> uha4: then, in order to get the id of the 'food_category' you should use: Pool().get('ir.model.data').get_id('module', 'xml_id')
2017-04-27 14:35 <uha4> does it make sense to cache the this category somewere more global, that this Pool().get() does not have to be executed everytime the getter function is called?
2017-04-27 14:36 <uha4> e.g. in a class attribute? it's anyway never going to change as long as the server is running...
2017-04-27 14:37 <pokoli> uha4: you don't have to worry about it
2017-04-27 14:37 <pokoli> uha4: there is also a Cache for get_id on ir.model.data and for me this will be enough
2017-04-27 14:38 <pokoli> uha4: but If you want to cache the value of the function field, you can create a Cache for it's values
2017-04-27 14:38 <pokoli> uha4: see http://doc.tryton.org/4.2/trytond/doc/ref/cache.html?highlight=cache
2017-04-27 14:39 <pokoli> uha4: just take care of clearing the cache when writting on the dependant fields
2017-04-27 14:40 <uha4> pokoli: I was just worried as Pool().get() sounds somehow expensive without knowing exactly what it does...
2017-04-27 14:41 <uha4> pokoli: thanks a lot...
2017-04-27 14:59 <pokoli> uha4: just take care to only initialize Pool() one time when getting multiple classes
2017-04-27 15:00 <pokoli> uha4: dont doot Pool().get('a'); Pool().get('b'), but do pool = Pool(); pool.get('a'); pool.get('b')
2017-04-27 15:04 <uha4> pokoli: but i have to initialize it within my on_change_with method? or is there a better place?
2017-04-27 15:08 <pokoli> uha4: you have to initialize it where you have to use it. So yes, on the on_change method if you are going to use there
2017-04-27 15:10 <uha4> pokoli: ok, so i got it right.
2017-04-27 15:35 -!- lukio(~lukio@host126.186-109-85.telecom.net.ar) has joined #tryton
2017-04-27 15:41 -!- kstenger(~karla@r186-55-66-228.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-04-27 16:13 -!- csotelo(~csotelo@179.7.36.250) has joined #tryton
2017-04-27 16:35 -!- marc_(~marc@170.red-80-28-119.adsl.static.ccgg.telefonica.net) has joined #tryton
2017-04-27 16:45 -!- JanGB(~jan@business-178-015-079-061.static.arcor-ip.net) has joined #tryton
2017-04-27 16:45 <dmollerm> Hi. I am trying to automate the trytond deployment into production and development servers and I have run across a particular problem:
2017-04-27 16:46 <dmollerm> When a module that had already been activated has a new tryon module dependency our deployment brings it to the python virtualenv, but then trytond won't start because the dependency is not activated, `trytond-admin --all` won't activate it, `trytond-admin -m` won't run, `trytond-admin -u mymodule` won't run either...
2017-04-27 16:46 <dmollerm> The only solution is to run `trytond-admin -m new_dependency`, but if there is a whole new bunch of modules this is not trivial to do. My question is: is there any reason for `trytond-admin -u mymodule` not activating the modules "mymodule" depends on? Is there any discussion/doc regarding this?
2017-04-27 16:47 -!- VaticanCameos(~VaticanCa@223.190.7.91) has joined #tryton
2017-04-27 16:47 <dmollerm> Sorry, the command was `trytond-admin -u new_dependency`
2017-04-27 16:48 <cedk> dmollerm: I think the reason is explicit is better than implicit
2017-04-27 16:50 <kstenger> I would agree, but when you activate a module from the client it actually activates also it's dependencies, which is a bit contradicting :-)
2017-04-27 16:51 <cedk> kstenger: the wizard tells you what is going to happen and you can change it
2017-04-27 16:51 <kstenger> ah, true
2017-04-27 16:52 <cedk> also it is different to activate a new module because of a new dependency than activate depenency to active a module
2017-04-27 16:52 <cedk> but it is true that it will be great to have trytond-admin to activate dependencies on new module activation
2017-04-27 16:53 <kstenger> ideally it could be interactive
2017-04-27 16:55 <cedk> kstenger: yes or display the list of module to also activate
2017-04-27 16:55 <kstenger> exactly this is what I meant
2017-04-27 16:56 <kstenger> so it's exclicit but still scriptable
2017-04-27 16:56 <kstenger> explicit*
2017-04-27 16:57 -!- thaneor1(~ldlc6@r179-25-75-20.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-04-27 17:00 <cedk> kstenger: indeed for now, it should the first level of missing module, it will be better to show all
2017-04-27 17:00 <dmollerm> Maybe a new command line option that assumes you want to activate any needed dependency? (apt-get style)
2017-04-27 17:01 <cedk> ho non, do not take apt-get as example of good command line :-)
2017-04-27 17:03 <kstenger> cedk: would you please reword "indeed for now, it should the first level of missing module, it will be better to show all"
2017-04-27 17:04 <dmollerm> It was just to name a popular package manager. pip, npm, yum, composer and so on have similar behaviours: prompt if you really want all the dependencies or provide an option that assumes "yes"
2017-04-27 17:07 <cedk> kstenger: if you try to install a module A that depends on B and B depends on C
2017-04-27 17:07 <cedk> kstenger: any of those modules are activated
2017-04-27 17:08 <cedk> kstenger: you try to activate A, trytond-admin will tell you that it is missing B
2017-04-27 17:08 <cedk> but nothing about C
2017-04-27 17:08 <cedk> dmollerm: I think activate module is different of installing a module
2017-04-27 17:09 <cedk> dmollerm: it is most of the time irreversible operation so we can not use the same logic as package manager
2017-04-27 17:10 <kstenger> cedk: got it now, but I guess it would tell you about C if on a second step you tell it to install B, do you agree ?
2017-04-27 17:10 -!- JanGB(~jan@dslb-088-073-244-178.088.073.pools.vodafone-ip.de) has joined #tryton
2017-04-27 17:14 <cedk> kstenger: I think it is the case now (was not before) but it should be tested
2017-04-27 17:14 -!- lukio(~lukio@host126.186-109-85.telecom.net.ar) has joined #tryton
2017-04-27 17:14 <dmollerm> cedk: indeed, but if the user is prompted about this or an "--assume-yes" option is provided I see no reason to activate dependencies despite the irreversible changes in the DB.
2017-04-27 17:17 <cedk> dmollerm: last time I look at that, it was too complex to implement
2017-04-27 17:29 <dmollerm> cedk: traversing and parsing a tryton.cfg tree? Or messing with the "check whether this dependency is already installed"?
2017-04-27 17:33 <dmollerm> Just saying... I'll have to look into this sooner or later for our deployments, but if the community does not agree that this would be a nice-to-have I'd rather develop a custom tool than maintain a tryton-admin feature
2017-04-27 17:35 <cedk> dmollerm: activate the missing module because we do not have the ORM
2017-04-27 17:36 <cedk> also the best will be to reuse ir.module function but it is not available
2017-04-27 17:37 -!- JosDzG(~Thunderbi@189.250.122.148) has joined #tryton
2017-04-27 17:40 -!- dm0ller(~dmollerm@170.red-80-28-119.adsl.static.ccgg.telefonica.net) has joined #tryton
2017-04-27 17:42 -!- JosDzG(~Thunderbi@189.250.122.148) has joined #tryton
2017-04-27 17:55 <pokoli> dmollerm: cedk kstenger it is not https://bugs.tryton.org/issue5696 ?
2017-04-27 17:56 <pokoli> indeed when I first tough about this issue I had the same use case as dmollerm
2017-04-27 17:57 -!- lukio(~lukio@181.47.212.165) has joined #tryton
2017-04-27 18:03 <dmollerm> pokoli: yes! thank you
2017-04-27 18:04 -!- JanGB(~jan@dslb-088-073-244-178.088.073.pools.vodafone-ip.de) has left #tryton
2017-04-27 19:04 -!- iscadrian(~androirc@2600:8803:ac01:5800:606f:e708:daaa:cebb) has joined #tryton
2017-04-27 19:52 <kstenger> pokoli: indeed
2017-04-27 21:44 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton
2017-04-27 21:48 -!- kstenger(~karla@r167-56-247-29.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-04-27 22:19 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton
2017-04-27 22:49 -!- JanGB(~jan@dslb-088-073-244-178.088.073.pools.vodafone-ip.de) has joined #tryton

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