Pb with complex domain expressions
This bug report was converted into a question: question #166085: Pb with complex domain expressions.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
I have a problem with complex domain expressions ; it may be a bug of the OpenERP server, but it may also be a bad domain expression due to a bad comprehension of the way it is supposed to work.
In an ir.actions.
1) I want to filter on open invoice/refunds that are either from Asustek with country = Taiwan or from Direct PC with country = Belgium, so I write the following expression :
<field name="domain"
Result : it works OK.
2) I want to filter on open customer invoices that are either from Asustek with country = Taiwan or from Direct PC with country = Belgium, so I write the following expression :
<field name="domain"
Result : NOT OK, I get ALL the invoices !
I have this problem with OpenERP server branch 5.0 and branch 6.0 ; I wanted to test on trunk, but I can't find the "Modules" menu entry to install my module !
By the way, my source of information about complex domain expressions is this one :
http://
plus wikipedia to understand "polish expressions" and "arity".
description: | updated |
description: | updated |
Changed in openobject-server: | |
status: | In Progress → Triaged |
On Tuesday 26 July 2011, you wrote: act_window on the object account.invoice : >['& ', '|', '&', invoice_ id.country_ id.name' , '=', 'Taiwan'), invoice_ id.country_ id.name' , '=', 'Belgium'), >['& ', '&', '|', '&', invoice_ id.country_ id.name' , '=', 'Taiwan'), invoice_ id.country_ id.name' , '=', 'Belgium'), )]</field>
> Public bug reported:
>
> I have a problem with complex domain expressions ; it may be a bug of
> the OpenERP server, but it may also be a bad domain expression due to a
> bad comprehension of the way it is supposed to work.
>
> In an ir.actions.
>
> 1) I want to filter on open invoice/refunds that are either from Asustek
> with country = Taiwan or from Direct PC with country = Belgium, so I
> write the following expression :
>
> <field name="domain"
> ('address_
> ('partner_id.name', '=', 'ASUStek'), '&',
> ('address_
> ('partner_id.name', '=', 'Distrib PC'), ('state', '=', 'open')]</field>
>
> Result : it works OK.
>
> 2) I want to filter on open customer invoices that are either from
> Asustek with country = Taiwan or from Direct PC with country = Belgium,
> so I write the following expression :
>
> <field name="domain"
> ('address_
> ('partner_id.name', '=', 'ASUStek'), '&',
> ('address_
> ('partner_id.name', '=', 'Distrib PC'), ('state', '=', 'open'), ('type',
> '=', 'out_invoice'
>
> Result : NOT OK, I get ALL the invoices !
>
Strange, to me, it seems to be working fine with both of your expressions:
BQI account.invoice> table id, partner_id, state from read([6,7,8,9]) ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---
id| partner_id | state
-------
9 |[7, 'Axelor'] |open
8 |[11, 'Distrib PC']|draft
7 |[11, 'Distrib PC']|open
6 |[2, 'ASUStek'] |open
BQI account.invoice> do search(['&', '|', '&', invoice_ id.country_ id.name' , '=', 'Taiwan'), ('partner_id.name', invoice_ id.country_ id.name' , '=', 'Belgium'), invoice_ id.country_ id.name' , '=', 'Taiwan'), ('partner_id.name', invoice_ id.country_ id.name' , '=', 'Belgium'),
('address_
'=', 'ASUStek'), '&', ('address_
('partner_id.name', '=', 'Distrib PC'), ('state', '=', 'open')])
Res: [7, 6]
BQI account.invoice> do search(['&', '&', '|', '&',
('address_
'=', 'ASUStek'), '&', ('address_
('partner_id.name', '=', 'Distrib PC'), ('state', '=', 'open'), ('type', '=',
'out_invoice')])
Res: [7, 6]
BQI> server get environment environment' ()
execute: 'get_server_
Result:
Environment Information : 0.0-rc4+ -x86_64- with-mandrake- 1-Official
System : Linux-3.
OS Name : posix
LSB Version: *
Distributor ID: Mageia
Description: Mageia 1
Release: 1
Codename: valstar
Operating System Release : 3.0.0-rc4+
Operating System Version : #5 SMP Sat Jun 25 14:36:11 EEST 2011
Operating System Architecture : 64bit
Operating System Locale : el_GR.UTF-8
Python Version : 2.7.1
OpenERP-Server Version : 6.0.2
(also tested...