many2one functional field not supported in view

Bug #1080536 reported by Kyle Waid

This bug report was converted into a question: question #223411: many2one functional field not supported in view.

6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

I tried to create a many2one functional field

        'refund_ids_list': fields.function(_get_payments_for_refund, type='many2one', relation='account.voucher', string="stuff", method=True, store=False)

I put this field in the view.

I cannot load the view. It appears that these types of fields are not supported in a view

Server Traceback (most recent call last):
  File "/usr/local/openerp/web/addons/web/common/http.py", line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/local/openerp/openerp-server/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/local/openerp/openerp-server/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/local/openerp/openerp-server/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/local/openerp/openerp-server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/local/openerp/openerp-server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/local/openerp/openerp-server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/local/openerp/openerp-server/openerp/osv/orm.py", line 3416, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/local/openerp/openerp-server/openerp/osv/orm.py", line 3542, in _read_flat
    record[f] = res2[record['id']]
KeyError: 13

Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote :

Hello Kyle Waid,

I have checked your issue with latest trunk, but I did not face any issue. So would you please provide a proper steps to
reproduce the bug.

For more information:

You can see the many2one function field defined in the account/account_bank_statement.py(line no: 128):

'currency': fields.function(_currency, string='Currency', type='many2one', relation='res.currency'),

and corresponding in the account/account_view.xml(line no: 564), remove the invisible="1" and you can see the 'Currency' field in the following form view:
Invoicing -> Bank and Cash -> Bank Statements.

By seeing the traceback it seems that problem is in the function you defined.

Thanks,
Divyesh

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenERP Server because there has been no activity for 60 days.]

Changed in openobject-server:
status: Incomplete → Expired
Changed in openobject-server:
status: Expired → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.