Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to hide a Sale Order Line based on "is_delivery"?

By
Travis Waelbroeck
on 7/30/16, 7:44 PM 376 views

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?


0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 7/31/16, 2:05 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/30/16, 7:44 PM
Seen: 376 times
Last updated: 7/31/16, 2:05 AM