Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

How to hide the 'create' option on a field but not the 'create and edit' option?

形象
odoo
1 备注
形象
丢弃
形象
odoo
-
5 答案
0
形象
odoo
最佳答案

Many2one widget (default)

Options : Other possible options you can use with this widget.

  • no_quick_create - It will remove Create and edit... option.
  • no_create_edit - It will remove Create "entered text" option.
  • no_create - no_quick_create and no_create_edit combined.
  • no_open - in read mode: do not render as a link.

Example:

<field name="field_name" options="{'no_quick_create': True, 'no_create_edit' : True}"/>

You can refer it from  Here

形象
丢弃
0
形象
odoo
最佳答案

I have found the right way to write it. With this, the 'Create' option is invisible. The 'Create and edit...' is still there.

<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
    <attribute name="domain">['&amp;',('parent_id','=',partner_id),('type','=','delivery')]</attribute>
     <attribute name="options">{'no_quick_create':True}</attribute>
</xpath>


But it doesn't explain to me why the 'Create' option can create a new partner WITHOUT respecting 'Required=True' of a field declaration...


 

形象
丢弃
0
形象
odoo
最佳答案

Hi Pascal !

You can write attributes to avoid create and create and edit fields in many2one fields with this code:

Regards,

<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="options">{'no_quick_create':True,'no_create_edit':True}</attribute>
</xpath>
形象
丢弃
0
形象
odoo
最佳答案

Just replace attrs to options like below

<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
    <attribute name="options">{'no_create': True}</attribute>
</xpath>

形象
丢弃
0
形象
odoo
最佳答案

<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
    <attribute name="options">{'no_create': True}</attribute>
</xpath>

形象
丢弃