Tryton - Issues

 

Issue6448

Title Selection does not refresh according to its domain
Priority bug Status testing
Superseder Nosy List adrien.benduc, ced, nicoe, pokoli, reviewbot
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 reviewbot.

Messages
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-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
2017-04-24 16:19:22cedsetstatus: chatting -> need-eg
messages: + msg33373
2017-04-24 16:06:19adrien.benducsetstatus: invalid -> chatting
messages: + msg33372
2017-04-24 15:53:42cedsetstatus: chatting -> invalid
messages: + msg33371
2017-04-19 11:01:19cedsetstatus: need-eg -> chatting

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