Python 属性错误:尝试以xml格式写入时

Python 属性错误:尝试以xml格式写入时,python,xml,openerp,attributeerror,openerp-7,Python,Xml,Openerp,Attributeerror,Openerp 7,我正在尝试更新我的表单视图xml。这是我的密码: def update_column(self,cr,uid,ids,context=None): for id in ids: temp=self.pool.get('deg.form').browse(cr,uid,id) fields={'myname':temp.name,'mytype':temp.data_type} self._columns.u

我正在尝试更新我的表单视图xml。这是我的密码:

def update_column(self,cr,uid,ids,context=None):
        for 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
这是我的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 for x in self._columns.keys() if self._columns[x]._type=='boolean']
AttributeError: 'unicode' object has no attribute '_type'
我尝试了两天,现在我没有任何想法。非常感谢您对解决方案的任何帮助或指导。
谢谢

其中一个
self.\u列
是一个unicode对象。原因是您使用错误的数据类型更新了
self.\u列
。它保留
{'field_name':openerp.osv.fields.date对象}
,但在这里:

temp=self.pool.get('deg.form').browse(cr,uid,id)
fields={'myname':temp.name,'mytype':temp.data_type}
self._columns.update(fields)

您可以使用奇怪的值更新\u列。

有没有解决方案?将字段dict更改为类似{'column\u name':fields.integer('Field object')的内容
temp=self.pool.get('deg.form').browse(cr,uid,id)
fields={'myname':temp.name,'mytype':temp.data_type}
self._columns.update(fields)