IRC logs of #tryton for Wednesday, 2018-03-28

chat.freenode.net #tryton log beginning Wed Mar 28 00:00:01 CEST 2018
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton23:26
-!- cdchapman(~perturbed@c-67-169-243-133.hsd1.ut.comcast.net) has joined #tryton01:10
-!- mono(~mono@201.184.144.165) has joined #tryton01:16
-!- kstenger(~karla@r186-55-75-95.dialup.adsl.anteldata.net.uy) has joined #tryton01:24
-!- zmijunkie1(~Adium@200116b80a2c1d009c9092826cdbdbb7.dip.versatel-1u1.de) has joined #tryton02:04
-!- yangoon1(~mathiasb@i59F4A741.versanet.de) has joined #tryton02:36
-!- mono(~mono@201.184.144.165) has joined #tryton03:23
-!- udono1(~udono@075-057-210-188.ip-addr.inexio.net) has joined #tryton04:19
-!- _2cadz(~2cadz@212-198-245-154.rev.numericable.fr) has joined #tryton05:46
-!- hedererjs(~hedererjs@dig50-1-78-222-206-45.fbx.proxad.net) has joined #tryton06:26
-!- JanGB(~jan@nat3.hmt-leipzig.de) has joined #tryton06:53
-!- mrichez(~smuxi@mail.saluc.com) has joined #tryton07:08
-!- Timitos(~kpreisler@host-88-217-184-172.customer.m-online.net) has joined #tryton07:13
-!- zmijunkie(~Adium@x2f7f12a.dyn.telefonica.de) has joined #tryton07:21
-!- zmijunkie(~Adium@b2b-78-94-52-226.unitymedia.biz) has joined #tryton07:47
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton07:52
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton08:14
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton08:17
-!- nicoe(~nicoe@host-85-201-184-151.dynamic.voo.be) has joined #tryton08:19
-!- JanGB(~jan@nat3.hmt-leipzig.de) has joined #tryton08:52
-!- _2cadz_(~2cadz@80.215.72.209) has joined #tryton10:10
-!- _2cadz(~2cadz@212-198-245-154.rev.numericable.fr) has joined #tryton10:25
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton10:45
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton10:47
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton11:02
-!- mariomop(~quassel@181.91.17.234) has joined #tryton11:15
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton12:12
-!- _2cadz(~2cadz@212-198-245-154.rev.numericable.fr) has joined #tryton12:30
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton12:32
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton12:46
-!- hedererjs(~hedererjs@dig50-1-78-222-206-45.fbx.proxad.net) has joined #tryton12:48
-!- kstenger1(~karla@r186-49-252-111.dialup.adsl.anteldata.net.uy) has joined #tryton13:26
-!- csotelo(~csotelo@179.43.97.56) has joined #tryton13:41
-!- rpit(~rpit@ip-109-40-2-115.web.vodafone.de) has joined #tryton14:20
-!- _2cadz_(~2cadz@212-198-245-154.rev.numericable.fr) has joined #tryton14:23
-!- andrespoliti(~andrespol@250-183-89-200.fibertel.com.ar) has joined #tryton14:39
andrespolitihi, i have a function one2many that calculates some totals. It's not persisted and the calculations are way too complicated to do them as a sql view, so i did it in the on_change, but now, the save confirmation dialog pops up when the function field has data. Is there a way of disabling the save dialog if this field detects changes?14:41
andrespolitimy question is similar to a previous question i made https://www.tryton.org/~irclog/2017-10-05.log.html but now i can't solve it by defining an sql view14:41
pokoliandrespoliti: your function probably does not return the correct values and the client thinks that the user has changed it14:43
pokoliandrespoliti: one reason can be that you are returning more digits than the ones expected by the client (defined in field definition)14:44
andrespolitino, it's not it, i fill the one2many with empty lines and the dialog still pops up14:55
andrespolitiempty dictionaries14:56
andrespolitii think the dialog pops up because the model detects that the function one2many changed14:57
pokoliandrespoliti: I think what you are trying to achieve is: https://bugs.tryton.org/issue376414:59
andrespolitipokoli: i don't know if this is correct, but the function one2many on_change depends on the model's id, so it gets filled as soon as the user opens a record14:59
andrespolitipokoli: yes, i want to give the one2many a list of dicts of computed data15:05
andrespolitiis there any way around the save dialog?15:16
andrespolitiwould replacing the on_change with a getter work?15:19
pokoliandrespoliti: the problem is that the API is based on ids, so you should always give the same id to the generated records15:32
pokoliandrespoliti: using negative ids will not work as the client will consider them new records15:33
pokoliandrespoliti: I remember making it work, but it required some hack on the target model15:33
andrespolitithe target model is a modelView, i created it specially for this case15:33
pokoliandrespoliti: If you have a fixed number of records on the relation, you can use a table query to create the ids and then add functional fields to compute the values15:34
andrespolitimm i don't think so, it can have any number of records15:34
pokoliandrespoliti: could you explain what are you calculating?15:41
andrespolitifor a party, i calculate the total amounts of vouchers and settlements, grouped by year and month15:42
andrespolitibut inside each record, there are other calculations that are also grouped15:43
pokoliandrespoliti: the first sentence sounds as calculable in a sql query, so better if you can use a ModelSQL wiht table_query15:44
andrespolitiyes, but it has multiple levels15:45
pokoliandrespoliti: by levels you mean that you have a tree?15:45
andrespolitithe target model also has 3 other function one2many's15:45
pokoliandrespoliti: here is an example on how to calculate a resum per month, year: http://hg.tryton.org/modules/sale_opportunity/file/0edc65ca5cd8/opportunity.py#l67515:46
pokoliandrespoliti: then you should create also 3 other table_queries, otherwise you will have the same problem15:47
andrespolitii don't think it's possible with sql, it's too complicated15:51
andrespolitii already tried15:52
andrespolitii think i'll try to disable the dialog in the client if the field is of type function15:52
pokoliandrespoliti: be sure to check that the function does not have a setter, otherwise it's doable to update a function field and it should trigger the save15:54
pokoliandrespoliti: what you are tryting to achieve is some kind of bussiness inteligence report?15:54
andrespolitiit's the sum of settlement amounts for each party, grouped by concept, and month and year15:58
cedkandrespoliti: use SQL15:59
pokoliandrespoliti: the sale_opportunity module is a good example on how to compute similar reporting, sharing same fields but diferent groupings16:01
cedkandrespoliti: indeed you just need to use SQL to get the lines you need and use Function field if you have complex computation16:04
-!- rpit(~rpit@p4FFB7E77.dip0.t-ipconnect.de) has joined #tryton17:27
-!- Telesight(~anthony@4dae0c97.ftth.telfortglasvezel.nl) has joined #tryton17:28
-!- zmijunkie(~Adium@i577B55D3.versanet.de) has joined #tryton19:50
-!- semarie(~semarie@unaffiliated/semarie) has joined #tryton20:00

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