This question has been flagged

I want to update the existing Sales Order Line tree view that is embedded in the default Odoo 9 Sales Order form view to hide a row based on a condition of the sales order line


View being modified: sale.view_order_form

<notebook>

<page string="Order Lines">

<field name="order_line" mode="tree,kanban" attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">

...

<tree string="Sales Order Lines" editable="bottom" decoration-info="invoice_status=='to invoice'">

<field name="sequence" widget="handle"/>

<field name="product_id"/>

<field name="name"/>

...

<field name="is_delivery" invisible="1"/>

...


Generally, there is only one item which "is_delivery", so I still want to see the rest of the items for the order.


I have tried using domain and attrs but so far I haven't had any success whatsoever. I think it is because the view is using the sale.order model, but the embedded tree view is using records from sale.order.line?


How can I hide the line item if "is_delivery" is True?


Avatar
Discard

have you found a way to do so?

Best Answer

Hello,

Just as a suggestion: try to add a new field to sale.order.line which is 'active', the active field toggle the global visibility of the record as in the documentation , and you can do some changes that when the order line set to is_delivery toTrue then set the active to False

hope this could helps

Avatar
Discard