Odoo Help

3

How to show active and non-active records in one2many tree view?

By
Marco Dieckhoff
on 3/4/13, 4:47 AM 5,280 views

Hi!

I want to show active and non-active records (here: of a one2many relationship) in the tree view of a subview together.

I tried

domain="['|',('active','=',True),('active','=',False)]"

to show both, but this had no effect - only active=True is shown. Even

domain=[('active','=',False)]

to show only non-active records does not work: it shows only active records, still.

Any hints or ideas? Is the many2one view broken in some way in 6.1?

<record id="model_form" model="ir.ui.view">
        <field name="name">model.form</field>
        <field name="model">model</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
                <form string="model">
                       <field name="name" colspan="4" />
                       ...
                       <separator colspan="4" string="Remotes" />
                            <field name="remote_ids" nolabel="1" colspan="4"
                            domain="['|',('active','=',True),('active','=',False)]">
                                    <tree string="Remote">
                                            <field name="name" />
                        ...
                                    </tree>
                                    <form string="Remote">
                                            <field name="name" colspan="4" />
                        ...
1
Ivan Elizaryev
On 1/15/16, 12:56 AM

Try to specify active_test in context to ignore active field


 <field name="remote_ids" context="{'active_test':False}">...
0
Andrias Yohanson
On 11/23/15, 1:45 AM

I wrote some code here the example.. it works for me

'jo_ids' : fields.one2many('jo.jo', 'employee_id', domain=['|',('active','=',False),('active','=',True)], string='No Jo'),
0
Sathiyan
On 3/4/13, 6:51 AM
  • Adding a filter in the search view for model.form should do.
  • You must have a "active" field in the form view of model.form view to use this,
  • <filter icon="terp-personal+" domain="[('active','=',True)]" name="active" string="Active"/>

Hope it Helps..

Sorry, I don't have a search view when the object is embedded as one2many field :)

BREMSKERL REIBBELAGWERKE, Marco Dieckhoff
on 3/4/13, 7:16 AM

Then you must inherit one from the model.from

Sathiyan
on 3/4/13, 9:11 AM

It's not about showing active lines from model.form, it's about the a subform view of the model related via remote_ids (in model.form), and the implicitly included subform defined by tree and form in field name="remote_ids".

(And yes, of course field name="active" is in the remote_ids block form, as invisible="1". I also tried to add it to tree.)

BREMSKERL REIBBELAGWERKE, Marco Dieckhoff
on 3/4/13, 11:06 AM

Your one2many field object is 'res.users' ?

saad
on 3/15/13, 8:22 AM

No, it's not res.users, it's an own module in development. But it shouldn't matter at all, which object is related. (As long as it has an "active" field.)

BREMSKERL REIBBELAGWERKE, Marco Dieckhoff
on 3/15/13, 8:34 AM
0
saad
On 3/4/13, 6:29 AM

I think you should override the search function of the one2many field object.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 3/4/13, 4:47 AM
Seen: 5280 times
Last updated: 1/15/16, 12:56 AM