← Back to team overview

openerp-india team mailing list archive

[Bug 462635] Re: Boolean field, fail when loading data xml files.

 

Changed status to Opinion.

Turning False into True due to the logic in class Boolean is so
mindboggingly user- an programmer unfriendly that this should really be
a bug.

class boolean(_column):
    _type = 'boolean'
    _symbol_c = '%s'
    _symbol_f = lambda x: x and 'True' or 'False'
    _symbol_set = (_symbol_c, _symbol_f)

IMHO the function _symbol_f should check for "false like" strings
(False, false, 0) and return False for those.

I was hit by this when attempting to change a report record:

        <report
            auto="False"
            id="sale.report_sale_order"
            model="sale.order"
            name="report_sale_order"
            rml="jma_sale/report/jma_sale_order.rmll"
            attachment_use="False"
            multi="False"
            usage="default"
            header="True" />

Most of the false and true values are taken from the standard in the account module. You are led tot believe you can
use False and True for any value. But in reality for a report tag special handling has been programmed for fields like auto, header,
multi and so on. But not for attachment_use. So the above will result in attachment_use=True.

A workaround is to not use a report element, but a genaral record. Like this:
        <record
            id="sale.report_sale_order"
            model="ir.actions.report.xml">
            <field name="rml">jma_sale/report/jma_sale_order.rml</field>
            <field name="attachment_use" eval="False" />
        </record>

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/462635

Title:
  Boolean field,  fail when loading data xml files.

Status in OpenERP Server:
  Opinion

Bug description:
  I'm loading our partner data with xml files, for example:

          <record id="res_partner_1" model="res.partner">
              <field name="name">Alternate</field>
              <field name="ref">ALTERNATE</field>
              <field name="lang">es_ES</field>
              <field name="vat">ESG08557985</field>
              <field name="title">ltd</field>
              <field name="vat_subjected">1</field>
              <field name="customer">False</field>
              <field name="supplier">True</field>
          </record>

  The result is ever customer and supplier True both.

  If you write next below, customer and supplier are True both too:
              <field name="customer">0</field>
              <field name="supplier">1</field>

  Only writting next below I can get the correct result:
              <field name="customer" eval="0"></field>
              <field name="supplier" eval="1"></field>

  I don't know if it's a bug, but can drive you crazy at first.

  
  Best Regards, 
  Gins
  "OpenERP is a beast, difficult to master, but when mastered, you become a beast"

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/462635/+subscriptions