How to create a dynamic view on OpenERP

廉价感情. 提交于 2019-11-28 08:48:14
OmaL

To add a dynamic view in openerp v6, override the function 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

result will be a dictionary which contain mainly two things, Xml architecture and fields. Provide the xml architecture in result['arch'] as string, provide the fields in result['fields'] as dictionary of dictionaries. Then return the result. Then you will get a view according to what you have given in the fields and architecure.

a simpler way would be... first get the expression from first form (FORM 1),and evaluate it as per your choice, and keep a "TEXT" field in second form which has this data in as per your format in that field..

Don Kirkby

I'm not sure exactly what you're asking, but if you just want to parse the user's expression, then this question on Python expression parsers should be helpful.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!