← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 718989] Re: [Trunk] related fields on a integer, display false for value 0

 

Humm, maybe need to do it in for record when instantce is a dict to ....
no found a form to test it atm

sorry for multi post, but i see that after post previous

so the patch look like

=== 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:48:49 +0000
@@ -819,8 +819,9 @@
                 # Converting value into string so that it does not affect XML-RPC Limits
                 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])
-                else:
+                        if not (isinstance(res[r],bool) and not res[r]):
+                            res[r][record] = str(res[r][record])
+                elif not (isinstance(res[r],bool) and not res[r]):
                     res[r] = str(res[r])
         return res

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
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.



References