IRC logs of #tryton for Wednesday, 2018-03-28 #tryton log beginning Wed Mar 28 00:00:01 CEST 2018
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton23:26
-!- cdchapman( has joined #tryton01:10
-!- mono(~mono@ has joined #tryton01:16
-!- kstenger( has joined #tryton01:24
-!- zmijunkie1( has joined #tryton02:04
-!- yangoon1( has joined #tryton02:36
-!- mono(~mono@ has joined #tryton03:23
-!- udono1( has joined #tryton04:19
-!- _2cadz( has joined #tryton05:46
-!- hedererjs( has joined #tryton06:26
-!- JanGB( has joined #tryton06:53
-!- mrichez( has joined #tryton07:08
-!- Timitos( has joined #tryton07:13
-!- zmijunkie( has joined #tryton07:21
-!- zmijunkie( has joined #tryton07:47
-!- cedk(~ced@gentoo/developer/cedk) has joined #tryton07:52
-!- rpit( has joined #tryton08:14
-!- rpit( has joined #tryton08:17
-!- nicoe( has joined #tryton08:19
-!- JanGB( has joined #tryton08:52
-!- _2cadz_(~2cadz@ has joined #tryton10:10
-!- _2cadz( has joined #tryton10:25
-!- rpit( has joined #tryton10:45
-!- rpit( has joined #tryton10:47
-!- rpit( has joined #tryton11:02
-!- mariomop(~quassel@ has joined #tryton11:15
-!- rpit( has joined #tryton12:12
-!- _2cadz( has joined #tryton12:30
-!- rpit( has joined #tryton12:32
-!- rpit( has joined #tryton12:46
-!- hedererjs( has joined #tryton12:48
-!- kstenger1( has joined #tryton13:26
-!- csotelo(~csotelo@ has joined #tryton13:41
-!- rpit( has joined #tryton14:20
-!- _2cadz_( has joined #tryton14:23
-!- andrespoliti( 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 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:
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:
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( has joined #tryton17:27
-!- Telesight( has joined #tryton17:28
-!- zmijunkie( has joined #tryton19:50
-!- semarie(~semarie@unaffiliated/semarie) has joined #tryton20:00

Generated by 2.17.3 by Marius Gedminas - find it at!