This question has been flagged
3 Replies
7411 Views
Hi folks,
I'm wondering if it could be possible to have a tree view inside a form (which is a one2many field) but filter the displayed data.
So: I have a form that contains lines (which have a state), and I want to only show the lines that are confirmed.
We already tried the option of another one2many field which would be computed based on the line state but in this case, the lines are not editable, which we don't want.
Thanks in advance!
Vàl
Avatar
Discard
Best Answer

if you want this filtering to be done in model, you should have first your filtered data, then override it in context when passing to view.  or pass altered values together in order to keep things in stable condition.


values['filtered_stuff'] = filtered_stuff
return request.module.render("module.view" values)


Avatar
Discard
Author Best Answer

Hi Bouabaker,

Thanks for your answer, unfortunately it wasn't what I was looking for.

Anyway, we found the solution,

Thanks!

Avatar
Discard

Can u please post the solution here.

Best Answer

Hi 

IfI understand, you will want something similar to showing customers, for example in the invoice without the suppliers

domain="[('customer', '=', True)]"

This requires two things to increase a true or false probability, for example

<field string="Customer" name="partner_id"   domain="[('customer', '=', True)]"/>

If you have the code to understand the problem more


Avatar
Discard