← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 654118] Re: Selection does not work for (stored) function fields

 

Hello DR Ferdinand,

Thanks for your suggestion. It is a very good idea. This idea has not
been implemented in current code. We may think over this idea for future
release, but not for 6.0 of course as we are very near to finish for the
release.

Thanks.

** Changed in: openobject-server
   Importance: Undecided => Wishlist

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
Selection does not work for (stored) function fields
https://bugs.launchpad.net/bugs/654118
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Server: Confirmed

Bug description:
*A definition for field "period_id" in table "xxx.yyy"
*
[.xml]:
    <record model="ir.ui.view" id="xxx_yyy_list">
      <field name="name"xxx.yyy.list</field>
      <field name="model">xxx.yyy</field>
      <field name="type">tree</field>
      <field name="arch" type="xml">
        <tree string="blah blah">
          <field name="period_id" readonly="1" select="1"/>
        </tree>
      </field>
    </record>

[.py]:
    _columns  = \
        {  'period_id' : fields.function
            ( _func
            , method   = True
            , string   = 'Period'
            , type     = 'many2one'
            , obj      = 'account.period'
            , store    = True
            , select   = True
            , required = True
            )
        }

*results in a traceback ("operator does not exist" in sql_db.py) when a 
search is filtered with a "period_id":
*
ProgrammingError: FEHLER:  Operator existiert nicht: integer ~~* unknown
ZEILE 1: ...ne" where (xxx_yyy.period_id ilike E'%...

*The SQL-snippet shows that the system tries a string-comparison 
("ilike") on the reference to the other table - which ist wrong!

The server log shows the following message:
*TIP:  Kein Operator stimmt mit dem angegebenen Namen und den 
Argumenttypen überein. Sie müssen möglicherweise ausdrückliche 
Typumwandlungen hinzufügen.
*("Operator does not match argument-type. Try a type-cast.")

When the definition is changed to
*
    _columns  = \
        {  'period_id' : fields.many2one
             ( 'account.period'
             , 'Period'
             , select   = True
             , required = True
             , readonly = True
             )
        }

*it works flawlessly