← Back to team overview

openerp-india team mailing list archive

[Bug 1084410] Re: [Trunk, 6.1 ] Order by don't work for related fields

 

Helllo Wowas,

Its already worked under offical code, please check the product.product
object on product module's 'name_template' field.

Would you please check the line number 536 and 555 of product/product.py
and remove the 'default_code' under _order then try. You will see all
are working correct.

You might have a mistake on your code. You was given the 'counter_id' as
m2o and your related field's type is date. So you have change the type
of the date_order is  type='manyo2one' or change the counter_id 's
type=''date.

Your this mistake is created this error.

Hope this will help you!

Note: date is again data type on postgres  so better not to give  date
name for field , So I would like to suggest don't give field name
"date".

Thanks for the reporting!

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

** Converted to question:
   https://answers.launchpad.net/openobject-server/+question/215620

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

Title:
  [Trunk,6.1 ] Order by don't work for related fields

Status in OpenERP Server:
  Invalid

Bug description:
  Order by don't work for related fields.

  For examples:
  1)
  class mega_maintenance_order(osv.osv):
      _name = 'mega.maintenance.order'

      _columns = {
          'name': fields.char('Name', size=64, required=True),
          'counter_id': fields.many2one('mega.maintenance.counter', 'Planned Counter', ondelete='cascade'),
          'date_order': fields.related('counter_id', 'date', type='date', string='Planned Date'),
      }

      _order = 'date_order desc'

  Will generate an error.

  ProgrammingError: column "date_order" does not exist
  LINE 1: ..._order".id FROM "mega_maintenance_order" ORDER BY date_order...
                                                                                                                            ^

  2)
  order_ids = self.pool.get('mega.maintenance.order').search(cr, uid, [], limit=1, order='date_order desc')

  Will not sort order by 'date_order'

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


References