python - attribute error: when trying to write in form xml -
i trying update form view xml. here code:
def update_column(self,cr,uid,ids,context=none): id in ids: temp=self.pool.get('deg.form').browse(cr,uid,id) fields={'myname':temp.name,'mytype':temp.data_type} self._columns.update(fields) print (self._columns) result = super(deg_form, self).create(cr,uid,{},context=none) return result 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, 145) 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': '"+objn.name+"', 'store': true,'size': 128}}" res['fields']=eval(str_fields) temp_arch="""<field name="father_name" />""" fields_string=res['arch'] index_of_end_group=fields_string.find('</group>') fields_string=fields_string[:index_of_end_group] + " " +temp_arch + " "+fields_string[index_of_end_group(inlove) res['arch']=fields_string return res
but getting error
attributeerror: 'unicode' object has no attribute '_type'
here stacktrace:
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 result = super(deg_form, self).create(cr,uid,{},context=none) file "/home/arsalan/openerp-7.0/openerp/osv/orm.py", line 4372, in create bool_fields = [x x in self._columns.keys() if self._columns[x]._type=='boolean'] attributeerror: 'unicode' object has no attribute '_type'
i trying since 2 days , out of ideas. or guide solution highly appreciated. thanks
one of self._columns
unicode object. reason update self._columns
wrong type of data. keeps {'field_name':openerp.osv.fields.date object}
here:
temp=self.pool.get('deg.form').browse(cr,uid,id) fields={'myname':temp.name,'mytype':temp.data_type} self._columns.update(fields)
you update _columns weird values.
Comments
Post a Comment