i do more test, and i tested gtk client, bug too when i add tree color
condition in a view
ValueError: invalid literal for int() with base 10: 'False'
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/openerp-client.py",
line 139, in <module>
gtk.main()
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/widget/view/tree_gtk/parser.py",
line 288, in setter
color = self.get_color(model)
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/widget/view/tree_gtk/parser.py",
line 324, in get_color
if model.expr_eval(cond, check_load=False):
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/widget/model/record.py",
line 297, in expr_eval
val = tools.expr_eval(dom, d)
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/tools/__init__.py",
line 54, in expr_eval
logging.getLogger('tools.expr_eval').exception(string)
File "/usr/lib/python2.6/logging/__init__.py", line 1080, in exception
self.error(*((msg,) + args), **{'exc_info': 1})
File
"/home/serge/Projects/openerp6/openerp_trunk/client/bin/tools/__init__.py",
line 52, in expr_eval
temp = eval(string, context)
temp = eval(string, context) <== crash on that
when string = 'int(counter)==2'
from
<tree string='Waiting list'
colors="black:int(counter)==0;green:int(counter)==1;orange:int(counter)==2;red:int(counter)>=3">
(i try to put row in different color in tree view, counter come in
string, so int('False')
Bug in server, because he return a 'False' as string
So to solve the problem, forget my previous patch, we only need to pass
the boolean and not the string, i tested and this modif work in GTK and
WEB client
Patch
=== modified file 'openerp/osv/fields.py'
--- openerp/osv/fields.py 2011-02-07 12:57:23 +0000
+++ openerp/osv/fields.py 2011-02-21 21:26:42 +0000
@@ -820,6 +820,8 @@
if isinstance(res[r],dict): # To treat integer values with
_multi attribute
for record in res[r].keys():
res[r][record] = str(res[r][record])
+ elif isinstance(res[r],bool) and not res[r]:
+ pass
else:
res[r] = str(res[r])
return res
--
You received this bug notification because you are a member of OpenERP
SA's Web Client R&D, which is a bug assignee.
https://bugs.launchpad.net/bugs/718989
Title:
[Trunk] related fields on a integer, display false for value 0
Status in OpenERP Web Client:
Confirmed
Bug description:
How reproduce the bug
Create a related fields to a integer fields, set value of the field
to 0, related fields show "false"
In bin/ovs/fields.py
class related function _fnct_read:
near line 902
if not t_data[self.arg[i]]:
t_data = False
Change by
if not (t_data[self.arg[i]] or (self._type =='integer' and
isinstance(t_data[self.arg[i]],int))):
t_data = False
That allow integer 0 to not be replace by False
But is not enougt
near line 914
elif t_data:
res[data.id] = t_data
change by
elif t_data or t_data==0:
res[data.id] = t_data
That allow 0 to be return as value
Note: is not a big problem, but when a secretary see a False in a field when
she supposed to see a 0, she not understand, she dont know in Programming 0
means False.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-web
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-web
More help : https://help.launchpad.net/ListHelp