Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
29089 Vizualizări

Hello, I have Odoo 9 CE.

I want to prevent opening elements when I click in an item of the tree view. I try to put editable="bottom" but not works, when I click on a order line element it opens all data of ther order line. I want to can't click on the element.

The purchase_order_form in where this tree view is contained is readonly, so i set create="false" edit="false" delete="false"


<tree string="Purchase Order Lines" editable="bottom">                                    
<field name="product_id" context="{'partner_id': parent.partner_id}"/>                                   
<field name="name"/>                                   
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>                                   
<field name="product_qty"/>                                   
<field name="qty_received" invisible="not context.get('show_purchase', False)"/>                                   
<field name="product_uom" groups="product.group_uom"/>                               
</tree>
Imagine profil
Abandonează
Cel mai bun răspuns

Dear Jose,

We can pass readonly="1" attribute in each field in the tree view. Like:

<tree string="Purchase Order Lines" editable="bottom">                                    
    <field name="product_id" context="{'partner_id': parent.partner_id}" readonly="1"/>                                   
    <field name="name" readonly="1"/>                                   
    <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" readonly="1"/>                                   
    <field name="product_qty" readonly="1"/>                                   
    <field name="qty_received" invisible="not context.get('show_purchase', False)" readonly="1"/>                                   
    <field name="product_uom" groups="product.group_uom" readonly="1"/>                               
</tree>

----------------- OR ---------------

If we set mode=tree only in action, it will not allow users to click on the tree. Like:

<record id="action_invoice_lines_vendor" model="ir.actions.act_window">
        <field name="name">Vendor Invoice Lines</field>
        <field name="res_model">account.invoice.line</field>
        <field name="type">ir.actions.act_window</field>
        <field name="view_mode">tree</field>
        <field name="view_type">form</field>
        <field name="domain">[('invoice_id.type', '=', 'in_invoice')]</field>
</record>

Hope this will work for you.

Thank you.


Imagine profil
Abandonează
Cel mai bun răspuns

Hi Jose,

try bellow code:

after changes your code should look like this:

<tree string="Purchase Order Lines" string="Sale Order" create="false" edit="false" editable="bottom">
    <field name="product_id" context="{'partner_id': parent.partner_id}"/>     <field name="name"/>     <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>     <field name="product_qty"/>     <field name="qty_received" invisible="not context.get('show_purchase', False)"/>     <field name="product_uom" groups="product.group_uom"/> </tree>
Imagine profil
Abandonează
Cel mai bun răspuns

Hello Haresh,

your solution does not work for me. I specified edit="false" and editable="bottom", but when I click on an item in the tree view, still the form is opened for the specified item. How to deactivate this? I don't want the row to link anywhere, also, the cursor should not change, because there are other links inside every row.

Thanks!

Imagine profil
Abandonează
Cel mai bun răspuns

don't use edit="false" with editable="bottom"

example:

<tree string="Purchase Order Lines" string="Sale Order" create="false" editable="bottom">
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
mai 23
2151
1
apr. 23
3724
2
mai 25
31264
2
sept. 22
5612
3
sept. 19
11771