Issue 9630

Title
client actions results in unloaded depends on the client side
Priority
bug
Status
resolved
Nosy list
ced, nicoe, reviewbot, roundup-bot
Assigned to
nicoe
Keywords
review

Created on 2020-09-23.18:47:43 by nicoe, last changed 1 month ago by roundup-bot.

Messages

New changeset 856f5c6f7d4f by Nicolas Évrard in branch 'default':
Ensure dependencies of fields are also loaded on Form display
https://hg.tryton.org/tryton-env/rev/856f5c6f7d4f
New changeset ccaef9daa811 by Nicolas Évrard in branch 'default':
Ensure dependencies of fields are also loaded on Form display
https://hg.tryton.org/trytond/rev/ccaef9daa811
New changeset dc0520e83643 by Nicolas Évrard in branch 'default':
Ensure dependencies of fields are also loaded on Form display
https://hg.tryton.org/tryton/rev/dc0520e83643
New changeset 9f7cab2d5c3a by Nicolas Évrard in branch 'default':
Ensure dependencies of fields are also loaded on Form display
https://hg.tryton.org/sao/rev/9f7cab2d5c3a
Author: [hidden] (nicoe) Tryton committer
Date: 2020-09-23.19:11:59
I don't think it's required to load the depends of the depends because those fields are used to evaluate the states of a field so only their value is important not the state in which they are.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-09-23.19:04:26
I guess you mean on Form.display to add to the fields loaded the depends of those fields?
But then should it not be required to also load the depends of the depends etc.
Author: [hidden] (nicoe) Tryton committer
Date: 2020-09-23.18:47:43
This a bit convoluted to reproduce so I'll give a small example.

Let's consider a simple model:

class A:
  a = fields.Char('a', depends=['b'])
  b = fields.Char('b', depends=['c'])
  c = fields.Char('c')

Let's say the first form view of A consists of only displaying "a" and the second consists of displaying both "a" and "b".

If a button in the first form view will trigger a switch to the second view then the value of "c" will stay unset. Which could be an issue if the visibility of "b" depends on it.

What happens is that the first view is loaded and the fields_view_get returns only the fields "a" and "b", they are both loaded. When the second view is loaded "c" is added to the group but since only "a" and "b" have a widget the display on the form will load them and since they are already loaded no RPC call will happen.

I think the way to solve this is to add the depends of the fields with a widget when displaying a form.
History
Date User Action Args
2021-03-11 23:35:04roundup-botsetmessages: + msg65429
2021-03-11 23:35:01roundup-botsetmessages: + msg65428
2021-03-11 23:34:57roundup-botsetmessages: + msg65427
2021-03-11 23:34:55roundup-botsetmessages: + msg65426
nosy: + roundup-bot
status: testing -> resolved
2021-01-07 11:26:53reviewbotsetmessages: + msg63798
2020-10-26 10:25:59reviewbotsetmessages: + msg61410
2020-10-22 00:04:47cedsetstatus: chatting -> testing
2020-10-09 18:57:06reviewbotsetmessages: + msg60714
2020-10-06 01:27:26reviewbotsetmessages: + msg60597
2020-10-05 14:28:46reviewbotsetmessages: + msg60583

Showing 10 items. Show all history (warning: this could be VERY long)