updating a calculated field while filling a form

30 просмотров
Перейти к первому непрочитанному сообщению

Cato Nano

не прочитано,
16 мар. 2018 г., 12:21:0816.03.2018
– tryton
My "total" field on the Bolletta entity is calculated.

It's the sum of a value from the lines PLUS some bits

In the GUI (and in SAO) the total gets updated while filling a line only with the value from said line

The further bits get acconted for only after saving the Bolletta.

I suppose that the javascript layer updates the total field generically summing on the client side

The complete calculation gets done on the server, after saving

Is there a way I could make the GUI showing the properly updated values while editing a line ?

Thanks in advance

Cato Nano

не прочитано,
16 мар. 2018 г., 13:07:4116.03.2018
– tryton
the values that do not get acconted for in the sum are calculated starting from line no. 8, as you can see here
https://gitlab.com/humanitiesNerd/tributi/blob/master/bolletta.py#L84

Cato Nano

не прочитано,
17 мар. 2018 г., 06:11:1717.03.2018
– tryton
I think the issue is: how do I get a calculated field updated with a temporary value BEFORE the record is saved ?

Cédric Krier

не прочитано,
17 мар. 2018 г., 08:30:0617.03.2018
– tryton
Using One2Many in on_change method can be a little bit tricky because we
have not yet a way to express what values will be sent. So the client
for now send all the values it knows and if it is a saved record the
server should read the missing value.
But in your code, you are calling other on_change methods and probably
they are missing some values.
A common tip to fix that is to add the missing field as tree_invisible
in the tree view to ensure to have them.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Cato Nano

не прочитано,
30 мар. 2018 г., 04:49:5030.03.2018
– tryton
Il giorno sabato 17 marzo 2018 13:30:06 UTC+1, Cédric Krier ha scritto:

> Using One2Many in on_change method can be a little bit tricky because we
> have not yet a way to express what values will be sent. So the client
> for now send all the values it knows and if it is a saved record the
> server should read the missing value.
> But in your code, you are calling other on_change methods and probably
> they are missing some values.
> A common tip to fix that is to add the missing field as tree_invisible
> in the tree view to ensure to have them.


Thank you

That made it
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений