Tryton - Issues



Title Warehouse and Storage location of production are readonly
Priority bug Status resolved
Superseder Nosy List ced, pokoli, roundup-bot
Type behavior Components sao
Assigned To ced Keywords

Created on 2017-10-26.16:06:57 by pokoli, last changed by roundup-bot.

New changeset 5bd1f7b4db5a by C├ędric Krier in branch 'default':
Use correct type for default value for Eval of inputs/outputs
msg37224 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-12-10.17:32:06
I understand what happens. The evaluation of the "Or" in javascript is different than in Python because the value of inputs is an empty list. An empty list is true in javascript.
Indeed "Or" pyson ensure that the expressions used are Boolean by checking the type (using the default value). And the __or__ operator is using 'Bool' pyson in case the expression is not already a boolean. Here the statement is cheating because it uses a boolean default value (used to know the type) when the real value will always be a list. So the __or__ does not add the 'Bool'.

For me, your proposed patch is correct.
msg36578 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-26.16:10:00
Indeed aplying the following patch on production module makes it works as expected:

diff -r bc084882c2e9
--- a/     Mon Oct 23 23:54:05 2017 +0200
+++ b/     Thu Oct 26 16:07:52 2017 +0200
@@ -62,7 +62,7 @@
             'readonly': (~Eval('state').in_(['request', 'draft'])
-                | Eval('inputs', True) | Eval('outputs', True)),
+                | Eval('inputs', [-1]) | Eval('outputs', [-1])),
     location = fields.Many2One('stock.location', 'Location', required=True,
@@ -71,7 +71,7 @@
             'readonly': (~Eval('state').in_(['request', 'draft'])
-                | Eval('inputs', True) | Eval('outputs', True)),
+                | Eval('inputs', [-1]) | Eval('outputs', [-1])),
     product = fields.Many2One('product.product', 'Product',

But as the problem is only reproducible on sao, I'm not sure if it's the proper fix, or something must be fixed on sao.
msg36577 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-26.16:06:57
In sao the warehouse and the storage location are shown as readonly when there are not inputs and no outputs. 

From the states definitions they should be editable. 

Reproduced on latests trunk but also on 4.4 demo. 

Everything works as expected on tryton.
Date User Action Args
2017-12-10 17:36:05roundup-botsetstatus: in-progress -> resolved
nosy: + roundup-bot
messages: + msg37225
2017-12-10 17:32:06cedsetstatus: chatting -> in-progress
assignedto: ced
messages: + msg37224
nosy: + ced
2017-10-26 16:10:00pokolisetstatus: unread -> chatting
messages: + msg36578
2017-10-26 16:06:57pokolicreate

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