تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
8 الردود
31952 أدوات العرض

I want to hide the 2 buttons on opportunity view : 'Create Quotation'  &  'Convert to Quotation' which are created by Xpath from sale_crm module:

<xpath expr="//field[@name='stage_id']" position="before">
<button attrs="{'invisible': [('probability', '&lt;', 100)]}" string="Create Quotation" name="618" type="action"/>
<button attrs="{'invisible': [('probability', '=', 100)]}" string="Convert to Quotation" name="618" type="action" class="oe_highlight"/>
</xpath>

how Can I do it ..??

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Below shown is just a sample of how to make a button invisible using xpath,

<record id="product_supplierinfo_form_view_inherit" model="ir.ui.view">    
<field name="name">product.supplierinfo.form.inherit</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
    <xpath expr="//button[@name='test_button']" position="attributes">
        <attribute name="invisible">1</attribute>
    
</xpath>
</field>
</record>

Check this and update yours accordingly.

Thanks

الصورة الرمزية
إهمال
الكاتب

these 2 buttons are created using xpath from sale_crm (default odoo module) module not implemented directly on opportunity form view ..

how can I hide them from my custom module

Then in the ref use the id of the previous xpath record id.

أفضل إجابة

Position attribute have following values.

  1. position="after" : To display field after parent form view field mentioned in "expr"

  2. position="before" : To display field before parent form view field mentioned in "expr"

  3. position="inside" : To display field inside notebook of parent form view

  4. position="attributes" : To change field attribute such as read only and visibility of a field

  5. position="replace" : To replace parent form view field with your newly created field

You can use above attributes as per your need.

الصورة الرمزية
إهمال

Here is complete code and description related to xpath, inheritance in views and model to modify existing model fields.

http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

Hope it may help you and others.

Thanks

أفضل إجابة

Hi Nebil 

You can do this change the  position="before" 

position="replace"
OR

<xpath expr="//button[@name='action_Create Quotation' and @states='draft']" position="attributes">
<attribute name="states" />
<!-- delete states attribute, it's influencing invisible behaviour -->
<attribute name="invisible">1</attribute>
</xpath>


الصورة الرمزية
إهمال
الكاتب

these 2 buttons are created using xpath from sale_crm (default odoo module) module not implemented directly on opportunity form view ..

how can I hide them from my custom module

salam nabil

You can better explain your need

you want to hide 2 buttons from which form

you can give us the source code or an image or link and the Version Odoo

الكاتب

This is my contact on Skype (aydi.nebil) .. Add me .. :)

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
ديسمبر 24
957
1
مارس 17
2895
2
ديسمبر 22
3040
2
يونيو 21
5120
4
مارس 17
8433