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

chat.freenode.net #tryton log beginning Fri Feb 10 00:00:01 CET 2017
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton01:38
-!- kstenger(~karla@r190-134-152-121.dialup.adsl.anteldata.net.uy) has joined #tryton01:50
-!- robinak(~quassel@unaffilated/robink) has joined #tryton02:02
-!- thaneor1(~ldlc6@r167-56-53-65.dialup.adsl.anteldata.net.uy) has joined #tryton05:42
-!- rpit(~rpit@aftr-37-24-151-100.unity-media.net) has joined #tryton07:44
-!- dj_xatra(~dj_xatra@217.166.83.130) has joined #tryton07:44
-!- thaneor(~ldlc6@r179-25-79-18.dialup.adsl.anteldata.net.uy) has joined #tryton08:36
-!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton08:57
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton09:01
-!- sisalp(~sisalpuse@ziozio.sisalp.net) has joined #tryton09:31
-!- rpit(~rpit@aftr-37-24-151-100.unity-media.net) has joined #tryton09:50
-!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton10:45
-!- daniel(~daniel@170.red-80-28-119.adsl.static.ccgg.telefonica.net) has joined #tryton11:57
-!- mariomop(~quassel@host23.186-108-112.telecom.net.ar) has joined #tryton11:59
Guest56032Hi 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 mi12:08
Guest56032ssing?12:08
pokoliGuest56032: you should pass the data to the client and then to the server for each call12:14
pokoliGuest56032: or save to the database12:15
cedkGuest56032: can you explain how it can be shared between users?12:15
Guest56032pokoli: 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.12:22
pokoliGuest56032: but you can run several trytond process that serve diferent processes and the memory is not shared between them12:22
pokoliGuest56032: I think we can provide better advices if you explain what's your use case12:23
Guest56032cdk: the wizard has a fake_view = StateView('mymodule.mymodel','mymodules.someview',[]) # but this values are actually meaningless12:24
Guest56032cedk: then in a start transition an attribute is attached to this stateview12:25
Guest56032def transition_start(self): self.fake_view.actual_instance = MyModel()12:25
Guest56032cedk: 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 :(12:27
pokoliGuest56032: but there is only one instance of this Model for all the wizards that run on the system?12:27
cedkGuest56032: are you sure it is the same instance?12:29
Guest56032pokoli: 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.12:31
pokoliGuest56032: 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=singleton12:32
Guest56032I'm pretty sure. The client has heavy evidence and I just reproduced it in the development environment.12:32
cedkGuest56032: I could you show the code12:32
Guest56032pokoli: 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)12:37
pokoliGuest56032: per session do you mean for each user session?12:39
Guest56032pokoli: yes!12:39
pokoliGuest56032: 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 transition12:40
pokoliGuest56032: I imagine that the user can leave the wizard in any intermediari state and you want to save this values. Is this right?12:41
-!- udono(~udono@229-137-067-156.ip-addr.inexio.net) has joined #tryton12:42
Guest56032pokoli: 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.12:43
pokoliGuest56032: then it is *per wizard session* and not per user session12:45
Guest56032pokoli: 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.12:45
Guest56032pokoli: sorry, I don't understand the difference between user session and wizard session.12:46
pokoliGuest56032: 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 transition12:47
pokoliGuest56032: per user is that the same user logged with two diferent machines will see the same values of the wizard12:47
pokoliGuest56032: but you said that you want them to not share the values12:48
Guest56032pokoli: right. So I see wee need the wizard session_id instead.12:51
pokoliGuest56032: wizard session_id should be managed automatically, you only have to pass the already filled values as default values for new transitions12:54
pokoliGuest56032: I'm not sure if I explain correctly12:54
Guest56032pokoli: 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?12:54
Guest56032pokoli: Yes, I understood that12:56
pokoliGuest56032: persisting the model is not required. Indeed you can send the values from server to client12:56
pokoliGuest56032: we have an example in the production module: http://hg.tryton.org/modules/production/file/dae737b21a61/bom.py#l27012:56
pokoliGuest56032: the bom tree is computed on server side and then the values are returned to the client wihtout persisting it12:57
-!- mamcode(~mamcode@201.211.15.126) has joined #tryton12:58
Guest56032pokoli: 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_ method12:59
pokoliGuest56032: but at the end you are creating a target model, don't you?13:05
pokoliGuest56032: The simplier way will be to create the object in some prelimiary state and at the final part of the wizard mark it as definitive13:08
Guest56032pokoli: 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.13:14
cedkGuest56032: so as far as I see there is no leak of object in current wizard design13:17
cedkGuest56032: and I think you should not use wizard to create record, wizards are there for short action that requires few input from the user13:17
cedkGuest56032: you should use standard record form13:17
pokoliGuest56032: i'm in Cedric here. Indeed we do it for standard documents (Sales, Purchases, Invoices, Moves, etc.) using the draft state13:18
-!- kobain(~kobain@unaffiliated/kobain) has joined #tryton13:58
-!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton14:01
-!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton14:35
-!- kobain(~kobain@unaffiliated/kobain) has joined #tryton14:53
-!- kobain(~kobain@unaffiliated/kobain) has joined #tryton14:53
Guest56032pokoli: cedk: Thank you for your help. I'll keep all this in mind to solve our problems. Have a nice day!15:20
-!- plaes(~plaes@unaffiliated/amd) has joined #tryton15:24
-!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton15:52
-!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton16:32
-!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton16:49
-!- JosDzG(~Thunderbi@fixed-188-72-187-188-72-36.iusacell.net) has joined #tryton18:17
-!- JosDzG(~Thunderbi@187.188.72.36) has joined #tryton18:38
-!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton18:45
andrespolitihello, 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?18:50
cedkandrespoliti: that's not a signature :-)18:51
andrespoliticedk: what do you mean?18:52
andrespolitii mean a graphical signature18:52
cedkandrespoliti: drawing in an image has no value as signature18:52
cedkandrespoliti: in digital world, signature is done with crypto18:57
-!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton19:06
-!- Pilou(~Pilou@2001:bc8:325a:200::) has joined #tryton20:24
-!- Pilou(~Pilou@pdpc/supporter/active/pilou) has joined #tryton20:24
-!- Pilou(~Pilou@2001:bc8:325a:200::) has joined #tryton20:25
-!- Pilou(~Pilou@pdpc/supporter/active/pilou) has joined #tryton20:26
-!- thaneor(~ldlc6@r179-25-180-207.dialup.adsl.anteldata.net.uy) has joined #tryton20:39
-!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton20:42
andrespolitiis there a way of specifying the time of a cron task? i need it to run daily as close as 00:00 hs as posible20:43
andrespolitianyone?21:10
-!- uha4(~uha4@146.0.96.225) has joined #tryton22:12
uha4Hello, is anyone able to tell me, how to change a One2Many field in a method?22:14
uha4I've tryed different ways: by setting it to a list of IDs or by setting the field.reference on the other end.22:16
uha4Changes 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.22:18
uha4how do I get the proper Transaction? Is there a better Way? I didn't find anything in the docs...22:19
cedkuha4: with an instance, you must assign the field with the full list of records22:23
cedkuha4: about readonly transaction, you can manage it with the __rpc__ but if it is readonly by default it is not intended to be changed22:24
cedkI guess you are in a on_change* transaction and it should never be changed to not introduce side effect22:24
uha4yes i am in a method called from a on_change* method.22:29
uha4cedk: 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...22:34
cedkuha4: but if you want to change the value of a one2many in the client then you can do it but do not call save22:43
cedkuha4: you can modify existing record and/or add/remove by assigning a modified list of record22:43
cedkuha4: you have to add the one2many in the fields.depends22:44
uha4cedk: how can i change something in the client by code? or do you mean proteus?22:51
cedkuha4: no, on_change methods are there to make change to the client22:57
uha4cedk: ok. But these changes live only in the client and shouldn't be saved unless the user tells the client to save?23:01
cedkuha4: that's it23:09
-!- JosDzG(~Thunderbi@187.188.72.36) has joined #tryton23:16

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