Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Attribute Error when calling fields_view_get

By
arsalan
on 4/22/14, 4:41 AM 1,291 views

Hi all, i am stuck in weird problem. i am trying to open my form view in button click event using

res = super(deg_form,self).fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False)

but on clicking button i get

Server Traceback (most recent call last):
  File "/home/arsalan/openerp-7.0/openerp/addons/web/session.py", line 90, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/arsalan/openerp-7.0/openerp/netsvc.py", line 295, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/arsalan/openerp-7.0/openerp/service/web_services.py", line 614, in dispatch
    res = fn(db, uid, *params)
  File "/home/arsalan/openerp-7.0/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/arsalan/openerp-7.0/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/arsalan/openerp-7.0/openerp/osv/osv.py", line 198, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/arsalan/openerp-7.0/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/arsalan/openerp-7.0/openerp/addons/system/myform.py", line 131, in update_column
    res = super(deg_form,self).fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False)
  File "/home/arsalan/openerp-7.0/openerp/osv/orm.py", line 2260, in fields_view_get
    xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
  File "/home/arsalan/openerp-7.0/openerp/osv/orm.py", line 1912, in __view_look_dom_arch
    fields = self.fields_get(cr, user, None, context)
  File "/home/arsalan/openerp-7.0/openerp/osv/orm.py", line 3511, in fields_get
    (field.groups and not self.user_has_groups(cr, user, groups=field.groups, context=context)):
AttributeError: 'unicode' object has no attribute 'groups'

Plz let me know what i am doing wrong here.

Thanks

Edit

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): 
       res = super(deg_form,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) 
       objn = self.pool.get('deg.form').browse(cr, uid, id) 
       if view_type=='form':
              str_fields=str(res['fields']) 
              str_fields=str_fields[:len(str_fields)-1]+ ", 'father_name' :{'selectable': True, 'views': {},'type':'char', 'string': 'father Name', 'store': True,'size': 128}}"
               res['fields']=eval(str_fields)
               temp_arch="""<field name="father">"""

can u post your fields_view_get full code?..

Prakash
on 4/22/14, 4:56 AM

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(deg_form,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) objn = self.pool.get('deg.form').browse(cr, uid, id) if view_type=='form': str_fields=str(res['fields']) str_fields=str_fields[:len(str_fields)-1]+ ", 'father_name' :{'selectable': True, 'views': {},'type':'char', 'string': 'ather Name', 'store': True,'size': 128}}" res['fields']=eval(str_fields) temp_arch="""<field name="father

arsalan
on 4/22/14, 6:05 AM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 4/22/14, 7:36 AM

In fields_view_get method Super class will at the end of the line.

Example, Refer the code in addons/stock/stock.py

def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
        if view_type == 'form' and not view_id:
            mod_obj = self.pool.get('ir.model.data')
       # Add Logic and finally return super class
        return super(class_name, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 4/24/14, 12:12 PM

I sense the problem is with your variables used!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/22/14, 4:41 AM
Seen: 1291 times
Last updated: 3/16/15, 8:10 AM