c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #16160
[Bug 718989] Re: [Trunk] related fields on a integer, display false for value 0
Hello Serge,
I have tested this issue using following test example and did not face
any problem as you specified in the bug specification.
=== modified file 'account/account_invoice_view.xml'
--- account/account_invoice_view.xml 2011-01-24 16:13:46 +0000
+++ account/account_invoice_view.xml 2011-02-15 07:13:16 +0000
@@ -345,6 +345,9 @@
</tree>
</field>
</page>
+ <page string="testing">
+ <field name="number_total"/>
+ </page>
</notebook>
</form>
</field>
=== modified file 'account/invoice.py'
--- account/invoice.py 2011-02-01 15:50:23 +0000
+++ account/invoice.py 2011-02-15 07:11:58 +0000
@@ -250,6 +250,7 @@
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 20),
},
multi='all'),
+ 'number_total': fields.related('amount_total', type='integer' , store=True, string='Test Number'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -285,6 +286,7 @@
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c),
'reference_type': 'none',
'check_total': 0.0,
+ 'number_total': 0,
'internal_number': False,
'user_id': lambda s, cr, u, c: u,
}
So would you please check again with latest updated code and notify me.
Thanks.
** Changed in: openobject-server
Status: New => Incomplete
--
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 Server:
Incomplete
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