在odoo中进行编辑和创建的不同视图形式 [英] different view form for edit and create in odoo

查看:203
本文介绍了在odoo中进行编辑和创建的不同视图形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在odoo中编辑模式和创建模式是否可能具有不同的表单视图?

I'd like to know is it possible to have different form views for edit mode and create mode in odoo ?

实际上,我只想在创建模式下隐藏一些元素,并在编辑模式下显示它.

Actually I just want to hide some elements in create mode and show it in edit mode.

我尝试使用类似attrs的方法:

I've tried to using attrs like :

<button name="%(print_invoice)d" string="Cetak Struk" type="action" attrs="{'invisible':[('id', '!=', False)]}" />    

但是当我打开表格时,它给了我这样的错误:

But when i open the form it gives me error like this :

Uncaught Error: Unknown field id in domain [["id","!=",false]]    

任何帮助将不胜感激.

谢谢

推荐答案

@qatz

基于记录的编辑"或创建",您不能有不同的视图.

You cannot have different views based on "Edit" or "Create" of record.

您可以通过添加状态"字段进行尝试,并根据状态值隐藏显示元素.

You can try this by adding "state" field and based on the value of state you can hide show the elements.

希望这会有所帮助!

这篇关于在odoo中进行编辑和创建的不同视图形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆