Tryton - Issues

 

Issue6448

Title Selection does not refresh according to its domain
Priority bug Status resolved
Superseder Nosy List adrien.benduc, ced, nicoe, pokoli, reviewbot, roundup-bot
Type behavior Components sao, tryton
Assigned To ced Keywords review
Reviews 37351002,38341002
View: 37351002, 38341002

Created on 2017-04-19.09:20:45 by adrien.benduc, last changed by roundup-bot.

Messages
New changeset a03520709ea4 by C?dric Krier in branch '4.2':
Skip validate only on constant readonly fields
http://hg.tryton.org/sao/rev/a03520709ea4

New changeset 1d67c1ae6154 by C?dric Krier in branch '4.0':
Skip validate only on constant readonly fields
http://hg.tryton.org/sao/rev/1d67c1ae6154

New changeset 05ebb4905e47 by C?dric Krier in branch '3.8':
Skip validate only on constant readonly fields
http://hg.tryton.org/sao/rev/05ebb4905e47
New changeset 28d7c7f26f88 by C?dric Krier in branch '4.2':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/28d7c7f26f88

New changeset b317aaa25460 by C?dric Krier in branch '4.0':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/b317aaa25460

New changeset db421e0108f7 by C?dric Krier in branch '3.8':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/db421e0108f7

New changeset 0021b51b1161 by C?dric Krier in branch '3.6':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/0021b51b1161

New changeset 83026d7e21d9 by C?dric Krier in branch '3.4':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/83026d7e21d9
New changeset e9613d7e20c4 by C?dric Krier in branch 'default':
Skip validate only on constant readonly fields
http://hg.tryton.org/sao/rev/e9613d7e20c4
New changeset 70185ef5c14d by C?dric Krier in branch 'default':
Skip validate only on constant readonly fields
http://hg.tryton.org/tryton/rev/70185ef5c14d
review38341002 updated at https://codereview.tryton.org/38341002/#ps1
review37351002 updated at https://codereview.tryton.org/37351002/#ps1
msg33377 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-24.18:14:55
Indeed it is the validation of the field that is no more trigger after it became read-only. So the domain inversion is never updated after being read-only once.
msg33375 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-24.17:25:42
This is not enough as you append a domain to an existing domain. It is not possible to know what is the final domain.
msg33374 (view) Author: [hidden] (adrien.benduc) Date: 2017-04-24.17:04:18
Here is the pastebin:
https://pastebin.com/sEGrQUJD
msg33373 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-24.16:19:22
So can you show the proper code?
msg33372 (view) Author: [hidden] (adrien.benduc) Date: 2017-04-24.16:06:18
No, the typo wasn't in my code
msg33371 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-24.15:53:42
Was the typo also in your code? If yes, it is the expected behaviour because you define a domain that is never valid for any selection item so it become readonly with its actual value.
Re-open the issue if it is not the case.
msg33277 (view) Author: [hidden] (adrien.benduc) Date: 2017-04-19.10:49:28
yep, sry for the typo
msg33276 (view) Author: [hidden] (nicoe) (Tryton committer) (Tryton translator) Date: 2017-04-19.10:35:55
In the second part of the If I guess it's 'selectable_value' and not kind, isn't it?
msg33272 (view) Author: [hidden] (adrien.benduc) Date: 2017-04-19.10:22:02
No, I'm not using the selection_change_with method, this is my approach:

depending_field = field.Selection([('only_a', 'Only A'), ('all', 'All')], 
    'Field Which Selectable Value Depends')
selectable_value = fields.Selection([('a', 'A'), ('b', 'B')], 'Selection',
    domain=[If(
        Eval('depending_field') == 'only_a',
        [('selectable_value', '=', 'a')],
        [('kind', 'in', ['a', 'b']]))
        ], depends=['depending_field'])
msg33271 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2017-04-19.09:38:33
Do you use a selection_change_with method?
msg33270 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-19.09:34:16
Please provide an easy way to reproduce the issue.
msg33269 (view) Author: [hidden] (adrien.benduc) Date: 2017-04-19.09:20:45
Here is the case:

I Have a Fields Selection which has a domain depending on another field.
This domain is a If Statement which should behaves as following:

- If the depending field have the value 'A', then there is only one selectable value in the field selection. Else, All other values are available.

When the first statement is True, the field selection correctly lock other values and become read only.
But if I change fields to apply the second statement, the field selection does not refresh and remains read only with only 1 selectable value.
History
Date User Action Args
2017-05-03 18:54:11roundup-botsetmessages: + msg33545
2017-05-03 18:53:35roundup-botsetmessages: + msg33544
2017-04-26 19:37:19roundup-botsetmessages: + msg33442
2017-04-26 19:37:05roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg33441
2017-04-24 18:41:05reviewbotsetmessages: + msg33379
2017-04-24 18:40:47reviewbotsetnosy: + reviewbot
messages: + msg33378
2017-04-24 18:17:59cedsetstatus: in-progress -> testing
reviews: 37351002,38341002
keyword: + review
2017-04-24 18:14:56cedsetstatus: need-eg -> in-progress
assignedto: ced
component: + sao
messages: + msg33377
2017-04-24 17:25:43cedsetstatus: chatting -> need-eg
messages: + msg33375
2017-04-24 17:04:18adrien.benducsetstatus: need-eg -> chatting
messages: + msg33374

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