← Back to team overview

openerp-india team mailing list archive

[Bug 1037497] Re: ORM searching for calculated fields replaces query with 'True' with no warning

 

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

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

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

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

Title:
  ORM searching for calculated fields replaces query with 'True' with no
  warning

Status in OpenERP Server:
  Confirmed

Bug description:
  If I make an or query like this with partner_ref as part of the search
  the ORM silently replaces the partner_ref part with an expression that
  evaluates to true.  Since this is in an OR expression, this makes that
  whole part of the query redundant since anything OR TRUE is TRUE.

  At the very least it would be useful if there was some debug output
  saying what the ORM is doing.

  2012-08-16 10:49:00,507 12436 DEBUG ? openerp.netsvc.rpc.request: object.execute('openerp',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                1,
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                '*',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                'product.product',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                'search',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                ['|',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                 '|',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                 '|',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                 '|',
  2012-08-16 10:49:00,508 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['description', 'ilike', '%description%'],
  2012-08-16 10:49:00,509 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['description_sale', 'ilike', '%description_sale%'],
  2012-08-16 10:49:00,509 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['name', 'ilike', '%name%'],
  2012-08-16 10:49:00,509 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['default_code', 'ilike', '%default_code%'],
  2012-08-16 10:49:00,509 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['partner_ref', 'ilike', '%partner_ref%'],
  2012-08-16 10:49:00,509 12436 DEBUG ? openerp.netsvc.rpc.request:                 ['active', '=', 1]])

  The code that does the replacement is in osv/expression.py and the
  code looks something like this,

                      # the function field doesn't provide a search function and doesn't store                                           
                      # values in the database, so we must ignore it : we generate a dummy leaf                                          
                      self.__exp[i] = TRUE_LEAF                                                                                          

  It's actually done in a couple of places and I'm not entirely sure
  which one I'm hitting.

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


References