IRC logs of #tryton for Friday, 2017-02-10

chat.freenode.net #tryton log beginning Fri Feb 10 00:00:01 CET 2017
2017-02-10 01:38 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton
2017-02-10 01:50 -!- kstenger(~karla@r190-134-152-121.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-02-10 02:02 -!- robinak(~quassel@unaffilated/robink) has joined #tryton
2017-02-10 05:42 -!- thaneor1(~ldlc6@r167-56-53-65.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-02-10 07:44 -!- rpit(~rpit@aftr-37-24-151-100.unity-media.net) has joined #tryton
2017-02-10 07:44 -!- dj_xatra(~dj_xatra@217.166.83.130) has joined #tryton
2017-02-10 08:36 -!- thaneor(~ldlc6@r179-25-79-18.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-02-10 08:57 -!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton
2017-02-10 09:01 -!- cedk(~ced@gentoo/developer/cedk) has joined #tryton
2017-02-10 09:31 -!- sisalp(~sisalpuse@ziozio.sisalp.net) has joined #tryton
2017-02-10 09:50 -!- rpit(~rpit@aftr-37-24-151-100.unity-media.net) has joined #tryton
2017-02-10 10:45 -!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton
2017-02-10 11:57 -!- daniel(~daniel@170.red-80-28-119.adsl.static.ccgg.telefonica.net) has joined #tryton
2017-02-10 11:59 -!- mariomop(~quassel@host23.186-108-112.telecom.net.ar) has joined #tryton
2017-02-10 12:08 <Guest56032> Hi everybody. I am trying to keep an instance of a tryton model across many steps of a wizard but I am running on some problems like it being destroyed from step to step or it being shared among concurrent users (when I hold the object inside a fake StateView that is never visited). I am planning to overload __getattr__ with a dict containing session_id-instance pairs but... is there any more standard solution I am mi
2017-02-10 12:08 <Guest56032> ssing?
2017-02-10 12:14 <pokoli> Guest56032: you should pass the data to the client and then to the server for each call
2017-02-10 12:15 <pokoli> Guest56032: or save to the database
2017-02-10 12:15 <cedk> Guest56032: can you explain how it can be shared between users?
2017-02-10 12:22 <Guest56032> pokoli: I'd rather have it in memory. I feel there is no need to serialize it until the final step when the model is persisted the usual way. But I'll investigate this, thank you.
2017-02-10 12:22 <pokoli> Guest56032: but you can run several trytond process that serve diferent processes and the memory is not shared between them
2017-02-10 12:23 <pokoli> Guest56032: I think we can provide better advices if you explain what's your use case
2017-02-10 12:24 <Guest56032> cdk: the wizard has a fake_view = StateView('mymodule.mymodel','mymodules.someview',[]) # but this values are actually meaningless
2017-02-10 12:25 <Guest56032> cedk: then in a start transition an attribute is attached to this stateview
2017-02-10 12:25 <Guest56032> def transition_start(self): self.fake_view.actual_instance = MyModel()
2017-02-10 12:27 <Guest56032> cedk: Sorry about the indentation. Then the actual instance can be accessed through all the steps. But through all concurrent users running the wizard as well :(
2017-02-10 12:27 <pokoli> Guest56032: but there is only one instance of this Model for all the wizards that run on the system?
2017-02-10 12:29 <cedk> Guest56032: are you sure it is the same instance?
2017-02-10 12:31 <Guest56032> pokoli: With this approach there is only one instance, effectively. This happens because the fake_view is never visited so it will remain in memory but it will be shared. If users are not concurrent this is not observed because the instance is reset in the start transition step.
2017-02-10 12:32 <pokoli> Guest56032: then you can use a singleton to persist it to the database: http://doc.tryton.org/4.2/trytond/doc/ref/tools/singleton.html?highlight=singleton
2017-02-10 12:32 <Guest56032> I'm pretty sure. The client has heavy evidence and I just reproduced it in the development environment.
2017-02-10 12:32 <cedk> Guest56032: I could you show the code
2017-02-10 12:37 <Guest56032> pokoli: but we do NOT want this model to be a singleton. Is there a mechanism to store values *per session*? (so it won't be stateless but I can live with that)
2017-02-10 12:39 <pokoli> Guest56032: per session do you mean for each user session?
2017-02-10 12:39 <Guest56032> pokoli: yes!
2017-02-10 12:40 <pokoli> Guest56032: if so you can create a normal table and use the create_uid to search if there is some previous object created and if not you should create on the start transition
2017-02-10 12:41 <pokoli> Guest56032: I imagine that the user can leave the wizard in any intermediari state and you want to save this values. Is this right?
2017-02-10 12:42 -!- udono(~udono@229-137-067-156.ip-addr.inexio.net) has joined #tryton
2017-02-10 12:43 <Guest56032> pokoli: We'd rather discard those values. Moreover, two people could be logged in with the same user and executing this wizard at the same time so we neither want them to share the instance.
2017-02-10 12:45 <pokoli> Guest56032: then it is *per wizard session* and not per user session
2017-02-10 12:45 <Guest56032> pokoli: Just to clarify, the wizard is just an aid the build a record of a model and peform some checks. The admin can just go to the model view and create one straight.
2017-02-10 12:46 <Guest56032> pokoli: sorry, I don't understand the difference between user session and wizard session.
2017-02-10 12:47 <pokoli> Guest56032: and in this case you should pass the values from server to client. Indeed the client does it automatically so you must pass the data as default value on every transition
2017-02-10 12:47 <pokoli> Guest56032: per user is that the same user logged with two diferent machines will see the same values of the wizard
2017-02-10 12:48 <pokoli> Guest56032: but you said that you want them to not share the values
2017-02-10 12:51 <Guest56032> pokoli: right. So I see wee need the wizard session_id instead.
2017-02-10 12:54 <pokoli> Guest56032: wizard session_id should be managed automatically, you only have to pass the already filled values as default values for new transitions
2017-02-10 12:54 <pokoli> Guest56032: I'm not sure if I explain correctly
2017-02-10 12:54 <Guest56032> pokoli: In order to send the model back and forth, as far as I know, I should either persist the stub object and pass the reference and eventually validate the stub or hide all the values of the model in the view. Am I wrong?
2017-02-10 12:56 <Guest56032> pokoli: Yes, I understood that
2017-02-10 12:56 <pokoli> Guest56032: persisting the model is not required. Indeed you can send the values from server to client
2017-02-10 12:56 <pokoli> Guest56032: we have an example in the production module: http://hg.tryton.org/modules/production/file/dae737b21a61/bom.py#l270
2017-02-10 12:57 <pokoli> Guest56032: the bom tree is computed on server side and then the values are returned to the client wihtout persisting it
2017-02-10 12:58 -!- mamcode(~mamcode@201.211.15.126) has joined #tryton
2017-02-10 12:59 <Guest56032> pokoli: but it's a quite large model and the wizard is intended to let you see few of its fields in each step (and guide its creation you with some logic). At the end I fear this approach will be too verbose and a change in the model will lead to a change in each step view and default_ method
2017-02-10 13:05 <pokoli> Guest56032: but at the end you are creating a target model, don't you?
2017-02-10 13:08 <pokoli> Guest56032: The simplier way will be to create the object in some prelimiary state and at the final part of the wizard mark it as definitive
2017-02-10 13:14 <Guest56032> pokoli: indeed, but I'd have to manage aborted wizards and add checks in many reports and business calculations. It'd be just a domain clause but if I have to persist stubs I think I'll keep them in a separate table and simply map them into a target record when the wizard execution is over.
2017-02-10 13:17 <cedk> Guest56032: so as far as I see there is no leak of object in current wizard design
2017-02-10 13:17 <cedk> Guest56032: and I think you should not use wizard to create record, wizards are there for short action that requires few input from the user
2017-02-10 13:17 <cedk> Guest56032: you should use standard record form
2017-02-10 13:18 <pokoli> Guest56032: i'm in Cedric here. Indeed we do it for standard documents (Sales, Purchases, Invoices, Moves, etc.) using the draft state
2017-02-10 13:58 -!- kobain(~kobain@unaffiliated/kobain) has joined #tryton
2017-02-10 14:01 -!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton
2017-02-10 14:35 -!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton
2017-02-10 14:53 -!- kobain(~kobain@unaffiliated/kobain) has joined #tryton
2017-02-10 14:53 -!- kobain(~kobain@unaffiliated/kobain) has joined #tryton
2017-02-10 15:20 <Guest56032> pokoli: cedk: Thank you for your help. I'll keep all this in mind to solve our problems. Have a nice day!
2017-02-10 15:24 -!- plaes(~plaes@unaffiliated/amd) has joined #tryton
2017-02-10 15:52 -!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton
2017-02-10 16:32 -!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton
2017-02-10 16:49 -!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton
2017-02-10 18:17 -!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton
2017-02-10 18:38 -!- JosDzG(~Thunderbi@187.188.72.36) has joined #tryton
2017-02-10 18:45 -!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton
2017-02-10 18:50 <andrespoliti> hello, i need to implement a signature field. Is there a way of drawing a signature in sao so it is persisted as an image in a binary field?
2017-02-10 18:51 <cedk> andrespoliti: that's not a signature :-)
2017-02-10 18:52 <andrespoliti> cedk: what do you mean?
2017-02-10 18:52 <andrespoliti> i mean a graphical signature
2017-02-10 18:52 <cedk> andrespoliti: drawing in an image has no value as signature
2017-02-10 18:57 <cedk> andrespoliti: in digital world, signature is done with crypto
2017-02-10 19:06 -!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton
2017-02-10 20:24 -!- Pilou(~Pilou@2001:bc8:325a:200::) has joined #tryton
2017-02-10 20:24 -!- Pilou(~Pilou@pdpc/supporter/active/pilou) has joined #tryton
2017-02-10 20:25 -!- Pilou(~Pilou@2001:bc8:325a:200::) has joined #tryton
2017-02-10 20:26 -!- Pilou(~Pilou@pdpc/supporter/active/pilou) has joined #tryton
2017-02-10 20:39 -!- thaneor(~ldlc6@r179-25-180-207.dialup.adsl.anteldata.net.uy) has joined #tryton
2017-02-10 20:42 -!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton
2017-02-10 20:43 <andrespoliti> is there a way of specifying the time of a cron task? i need it to run daily as close as 00:00 hs as posible
2017-02-10 21:10 <andrespoliti> anyone?
2017-02-10 22:12 -!- uha4(~uha4@146.0.96.225) has joined #tryton
2017-02-10 22:14 <uha4> Hello, is anyone able to tell me, how to change a One2Many field in a method?
2017-02-10 22:16 <uha4> I've tryed different ways: by setting it to a list of IDs or by setting the field.reference on the other end.
2017-02-10 22:18 <uha4> Changes didn't take effect. so i tryed to call self.save() immediately after. this seems to be the right way, but i get an InternalError: UPDATE impossible in a read-only-Transaction.
2017-02-10 22:19 <uha4> how do I get the proper Transaction? Is there a better Way? I didn't find anything in the docs...
2017-02-10 22:23 <cedk> uha4: with an instance, you must assign the field with the full list of records
2017-02-10 22:24 <cedk> uha4: about readonly transaction, you can manage it with the __rpc__ but if it is readonly by default it is not intended to be changed
2017-02-10 22:24 <cedk> I guess you are in a on_change* transaction and it should never be changed to not introduce side effect
2017-02-10 22:29 <uha4> yes i am in a method called from a on_change* method.
2017-02-10 22:34 <uha4> cedk: I was already thinking how i could arrange it differently, so i try it that way. But without knowing why i didn't think it's worth trying. Thanks...
2017-02-10 22:43 <cedk> uha4: but if you want to change the value of a one2many in the client then you can do it but do not call save
2017-02-10 22:43 <cedk> uha4: you can modify existing record and/or add/remove by assigning a modified list of record
2017-02-10 22:44 <cedk> uha4: you have to add the one2many in the fields.depends
2017-02-10 22:51 <uha4> cedk: how can i change something in the client by code? or do you mean proteus?
2017-02-10 22:57 <cedk> uha4: no, on_change methods are there to make change to the client
2017-02-10 23:01 <uha4> cedk: ok. But these changes live only in the client and shouldn't be saved unless the user tells the client to save?
2017-02-10 23:09 <cedk> uha4: that's it
2017-02-10 23:16 -!- JosDzG(~Thunderbi@187.188.72.36) has joined #tryton

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