Hello,

I am confirming this issue by applying the following example. In gtk
client it's working normal but in web-client field will passing 'False'
instead of 0.:


=== 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-16 08:16:01 +0000
@@ -151,6 +151,7 @@
                     <group col="8" colspan="4">
                         <field name="journal_id" 
on_change="onchange_journal_id(journal_id)" widget="selection"/>
                         <field name="number" readonly="1"/>
+                        <field name="counter"/>
                         <field name="type" invisible="1"/>
                         <field name="currency_id" width="50"/>
                         <button name="%(action_account_change_currency)d" 
type="action" icon="terp-stock_effects-object-colorize" string="Change" 
attrs="{'invisible':[('state','!=','draft')]}" 
groups="account.group_account_user"/>
@@ -261,6 +262,7 @@
                     <group colspan="4" col="8">
                     <field name="journal_id" groups="base.group_user" 
on_change="onchange_journal_id(journal_id)" widget="selection"/>
                     <field name="number"/>
+                    <field name="counter"/>
                     <field name="type" invisible="1"/>
                     <field name="currency_id" width="50"/>
                     <button name="%(action_account_change_currency)d" 
type="action" icon="terp-stock_effects-object-colorize" string="Change" 
attrs="{'invisible':[('state','!=','draft')]}" 
groups="account.group_account_user"/>

=== modified file 'account/invoice.py'
--- account/invoice.py  2011-02-01 15:50:23 +0000
+++ account/invoice.py  2011-02-16 06:43:13 +0000
@@ -216,6 +216,7 @@
             help="If you use payment terms, the due date will be computed 
automatically at the generation "\
                 "of accounting entries. If you keep the payment term and the 
due date empty, it means direct payment. The payment term may compute several 
due dates, for example 50% now, 50% in one month."),
         'partner_id': fields.many2one('res.partner', 'Partner', 
change_default=True, readonly=True, required=True, 
states={'draft':[('readonly',False)]}),
+        'counter': fields.related('partner_id', 'waiting_list_counter', 
string='Cancel', type='integer'),
         'address_contact_id': fields.many2one('res.partner.address', 'Contact 
Address', readonly=True, states={'draft':[('readonly',False)]}),
         'address_invoice_id': fields.many2one('res.partner.address', 'Invoice 
Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
         'payment_term': fields.many2one('account.payment.term', 'Payment 
Term',readonly=True, states={'draft':[('readonly',False)]},

=== modified file 'account/partner.py'
--- account/partner.py  2011-01-14 00:11:01 +0000
+++ account/partner.py  2011-02-16 06:42:45 +0000
@@ -145,6 +145,7 @@
             fnct_search=_credit_search, method=True, string='Total 
Receivable', multi='dc', help="Total amount this customer owes you."),
         'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, 
method=True, string='Total Payable', multi='dc', help="Total amount you have to 
pay to this supplier."),
         'debit_limit': fields.float('Payable Limit'),
+        'waiting_list_counter' : fields.integer('Missed Appointment'),
         'property_account_payable': fields.property(
             'account.account',
             type='many2one',
@@ -186,7 +187,10 @@
             'Companies that refers to partner'),
         'last_reconciliation_date': fields.datetime('Latest Reconciliation 
Date', help='Date on which the partner accounting entries were reconciled last 
time')
     }
-
+    
+    _defaults = {
+        'waiting_list_counter': 0,
+    }
 res_partner()
 

Hope this will help you.

Thanks.

** Changed in: openobject-client-web
   Importance: Undecided => Low

** Changed in: openobject-client-web
       Status: New => Confirmed

** Changed in: openobject-client-web
     Assignee: (unassigned) => OpenERP SA's Web Client R&D (openerp-dev-web)

-- 
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

Reply via email to