Discussion:
[tryton] updating a calculated field while filling a form
Cato Nano
2018-03-16 16:21:08 UTC
Permalink
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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/fa974780-3293-4c0f-bbd5-f7f510751c67%40googlegroups.com.
Cato Nano
2018-03-16 17:07:41 UTC
Permalink
Post by Cato Nano
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
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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/424d1eea-f0bc-4c0c-b5a9-e06d84116cac%40googlegroups.com.
Cato Nano
2018-03-17 10:11:17 UTC
Permalink
Post by Cato Nano
Post by Cato Nano
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
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
I think the issue is: how do I get a calculated field updated with a temporary value BEFORE the record is saved ?
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/af3683a6-fb11-4141-b0ca-cd374259d171%40googlegroups.com.
Cédric Krier
2018-03-17 12:29:37 UTC
Permalink
Post by Cato Nano
Post by Cato Nano
Post by Cato Nano
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
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
I think the issue is: how do I get a calculated field updated with a temporary value BEFORE the record is saved ?
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: ***@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/20180317122937.GC3935%40kei.
Cato Nano
2018-03-30 08:49:50 UTC
Permalink
Post by Cédric Krier
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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/45617398-51ab-4440-84ef-a0c3dbdcefb4%40googlegroups.com.
Loading...