如何在openerp 7模块中创建动态字段



我正在创建一个openerp 7模块,我一直在使用eclipse IDE和Python来运行代码。我想给出创建动态字段的功能。我想调用一个表单,其中字段的详细信息(名称、数据类型、大小)将由用户提供,以创建新字段。我对动态场的创建没有这样的想法。请帮帮我。

建议的希望

您可以在osv中使用fields_view_get函数来创建动态字段。继承fields_view_get()函数。

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False):
    result = super(<your_class_name>, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar)
    ###your modification in the view
    ###result['fields'] will give you the fields. modify it if needed
    ###result['arch'] will give you the xml architecture. modify it if needed
    return result

首先检查一下你的收获。然后在此基础上建立一个想法并继续。您可以在帐户模块account_invoice.py文件

中找到一个示例

最新更新