Domain on one2many field doesn't work

Bug #371367 reported by Christophe CHAUVET
90
This bug affects 17 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Server revno: 1766
Addons revno: 2306
Client revno: 962

When add a domain on a one2many field, the display content show all entry, the filter doesn't apply

Distribution: Ubuntu
Version: 8.10 (intrepid)
Python 2.5.2

Locale:
  LANG=fr_FR.UTF-8

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,

Probably, its not feasible.
Would you please tell me where you try to apply the domain to one2many?

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
thesleepless@gmail.com (thesleepless) wrote :

this bug also effects me.
i'm trying to include the attachments list for an object in a form.

eg.
'attachments': fields.one2many('ir.attachment','res_id','Attachments', domain="[('res_model','=','test.job')]" ),

the domain filter seems to be ignored.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [Bug 371367] Re: [5.0] domain on one2many field doesn't work

In my opinion, the domain must not work on a one2many field. A domain on
the object should be seen like a constraint, which is probably not what
you want.

A domain on the client side can be seen like a filter. So, if something
has to be changed, it's only on the client side. So, I put this as a
whishlist for now on. Please note that you can define your own field
that implement the domain. The module project_gtd does this if you need
an example.

<email address hidden> wrote:
> this bug also effects me.
> i'm trying to include the attachments list for an object in a form.
>
> eg.
> 'attachments': fields.one2many('ir.attachment','res_id','Attachments', domain="[('res_model','=','test.job')]" ),
>
> the domain filter seems to be ignored.
>

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
   -- Marty, 2005

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [5.0] domain on one2many field doesn't work

Has to be defined (and implemented) in the view, not on the object. (things on objects are constraints, not related to user interface/ergonomy).

Changed in openobject-server:
importance: Undecided → Wishlist
status: Incomplete → Confirmed
Revision history for this message
Parthiv Patel (parthiv-patel-deactivatedaccount) wrote :

Hello,

One way to apply domain on the O2M is to override the "get" method of one2many field. In get method you can apply the domain of your condition and then use that modified O2M class.

Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Hi folks, what about this issue, was implemented? in the view?

Regards,

Cristian

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Guys,

   It has been fixed in trunk. I have checked, the domain now works with fields.one2many.
   Thanks for the interest.

Thanks.

Changed in openobject-server:
importance: Wishlist → Medium
milestone: none → 6.0
status: Confirmed → Fix Released
summary: - [5.0] domain on one2many field doesn't work
+ Domain on one2many field doesn't work
Revision history for this message
Yan-PCSol (yannick-soldati) wrote :

in which rev is it fixed?

Revision history for this message
Thibaut DIRLIK (Logica) (thibaut-dirlik) wrote :

Yep, doesn't seems to work with latest 6.1 trunk.

Revision history for this message
Nicola Riolini - Micronaet (nicolariolini) wrote :

It's strange that with o2m doesn't work because I find that in many2many field seems working...
ex. in account.account form I can see (account/account_view.xml file):
     <field colspan="4" name="tax_ids" nolabel="1" domain="[('parent_id','=',False)]"/>

Revision history for this message
LAPTVN (laptvn) wrote :

I checked on my version 6.0.3, it still does not work.

Revision history for this message
Willem Verbruggen (willem-verbruggen) wrote :

Same here. Using 6.0.3. Tried domain on field definition in the object itself as well as from the view. Domain restriction does not get applied.

Revision history for this message
El Hadji Dem (http://www.savoirfairelinux.com) (eh-dem) wrote :

I try this in OpeneERP7.0, but it doesn't work.

Changed in openobject-server:
importance: Medium → Undecided
milestone: 6.0 → none
status: Fix Released → New
no longer affects: openobject-addons
Revision history for this message
Ravi Gohil (OpenERP) (rgo-openerp) wrote :

Domain on one2many fields isn't working as mentioned in comment #3, hence reopened the bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.