Commit Graph

22 Commits

Author SHA1 Message Date
Raphael Collet 6595cfdf0c [FIX] expression: avoid useless query when searching on x2many sub-field
Searching on a domain like `[('m2m.sub', operator, value)]` currently does
something like:

    right_ids = comodel.search([('sub', operator, value)]).ids
    table_ids = model.search([('m2m', 'in', right_ids)]).ids

and reduces the domain triple to `('id', 'in', table_ids)`.

The domain triple can actually be reduced to `('m2m', 'in', right_ids)`.  With
this reduction, the search on the field `m2m` will be done as part of the main
query.  And this will also enable the optimization of the former fix!
2017-04-06 16:46:46 +02:00
Denis Ledoux 8558ecfdf3 [MERGE] forward port of branch saas-3 up to dd8cbf4 2015-11-06 16:08:30 +01:00
Nicolas Lempereur d24fcd1d2e [IMP] base: test for expression distribute_not
Testing the use case of c28a28e, in which distribute_not was refactored
with iteration instead of recursion.
2015-11-05 17:13:55 +01:00
Cédric Pigeon 20b5e0a4ab [ADD] base: test to check too long table aliases
Test for rev. 11f538fae6
2015-09-08 11:53:29 +02:00
Christophe Simonis 15680c94e1 [MERGE] forward port of branch saas-3 up to revid 5115 chs@openerp.com-20140410102422-fcwxhjk40z0oy8x5
bzr revid: chs@openerp.com-20140410105454-6utwgruj80h8wdss
2014-04-10 12:54:54 +02:00
jba 1578776814 [FIX] expression: when evaluatoing *like operator, add cast to text to column in case of different type
bzr revid: mat@openerp.com-20140409144346-nbn0dno3bs6ozwk5
2014-04-09 16:43:46 +02:00
Christophe Simonis bcf36e6deb [IMP] expression: new helper for generating unaccent aware sql queries. Adapt _auto_join tests to use it.
bzr revid: chs@openerp.com-20140404141559-d2sn68lruik9hz81
2014-04-04 16:15:59 +02:00
Christophe Simonis 0161666e8b [MERGE] forward port of branch saas-3 up to revid 5112 chs@openerp.com-20140407144238-3s38zadkh7yxpdy7
bzr revid: chs@openerp.com-20140407160548-ttuc877kknuycoqw
2014-04-07 18:05:48 +02:00
Christophe Simonis 19993ab1d5 [FIX] expression: translated search as params are flatten, we need to expand "%s" placeholders when using the `in` operator
bzr revid: chs@openerp.com-20140402112730-eoqxt0pu7lvcq5yg
2014-04-02 13:27:30 +02:00
Antony Lesuisse 82372e6a02 move tests
move test modules
remove xml test
add phantomjs test
readd remove uninstall test (currently disabled because of cr.commit)

bzr revid: al@openerp.com-20140209003745-ehrx8ikwkmusa644
2014-02-09 01:37:45 +01:00
Olivier Dony 18ee18244f [FIX] test_expression: assertion was too sensitive to exact parameters
Now that res.partner.child_ids has an extra domain
attribute the exact number of parameters of queries
using `child_ids` in the WHERE clause is different.

bzr revid: odo@openerp.com-20130419173159-ef1onm3823hsi77n
2013-04-19 19:31:59 +02:00
Olivier Dony 41598ef041 [FIX] orm.expression: `=?` domain operator broken after 7.0 refactoring ; + added tests
lp bug: https://launchpad.net/bugs/1095635 fixed

bzr revid: odo@openerp.com-20130321173737-a0j330ro4i223fkb
2013-03-21 18:37:37 +01:00
Thibault Delavallée e36b44e82f [IMP] [WIP] order_by: now using aliases in _generate_order_by, _generate_o2m_order_by, _inherits_join_add, ... added some tests. Next comits will clean a bit the code, because currently it is a bit messy.
bzr revid: tde@openerp.com-20121207115424-x8gkjcqpi8dz96g2
2012-12-07 12:54:24 +01:00
Thibault Delavallée d588388ae4 [IMP] [CLEAN] expression.parse: updated and cleaned a bit the tests. Removed print statements.
bzr revid: tde@openerp.com-20121206162219-n1c48dkjghc4nu63
2012-12-06 17:22:19 +01:00
Thibault Delavallée a0b8a58174 [IMP] [REVIEW] _auto_join on many2many now raises a NotImplementedError; added a test case for that.
bzr revid: tde@openerp.com-20121206092745-a8t62khs4x37db1g
2012-12-06 10:27:45 +01:00
Thibault Delavallée a8359924c2 [IMP] expression.parse: added the support of domain on one2many fields when _auto_true is activated. Leaf creation from an existing leaf moved as a method in expression object. Added some comments. Added / updated some tests.
bzr revid: tde@openerp.com-20121204170744-rv8e0zlteqoyj60o
2012-12-04 18:07:44 +01:00
Thibault Delavallée 9e6c2805ab [REF] [IMP] expression.parse: refactored the main parsing loop, now using source and result stacks. Leaf elements are encapsulated into a specific object, allowing to delegate the join condition formation and aliases generation, as well as working_table management to them. The main parsing loop is now a loop taking a leaf, doing one action on it, and putting the result back to be analyzed or in the results. This allows to avoid having while loops inside a main while loop with some weird corner effects.
bzr revid: tde@openerp.com-20121204142650-gkhmjdeu5upi25kp
2012-12-04 15:26:50 +01:00
Thibault Delavallée 37a949e30a [DOC] First draft of doc on _auto_join, to at least have something.
bzr revid: tde@openerp.com-20121129152852-akslcby3ics61vuz
2012-11-29 16:28:52 +01:00
Thibault Delavallée a853b9f2ad [TEST] Added some tests about the _auto_join feature.
bzr revid: tde@openerp.com-20121128140042-4r58wnzahk0io3lw
2012-11-28 15:00:42 +01:00
Thibault Delavallée 8163c0027b [IMP] [TEST] orm: updated order_by generation by adding the root table name to the order by condition generated based on self._order. Added a mockup of where_calc in test_expression, to be able to track generated Query objects. Added a first test on a one2many query, to track current behavior.
bzr revid: tde@openerp.com-20121127160627-qs1tupvgr8ypexoo
2012-11-27 17:06:27 +01:00
Vo Minh Thu 56c1a398a0 [IMP] expression.py: added comments to the in/not in many2many tests.
bzr revid: vmt@openerp.com-20121026110109-l212flw0p5cklc6p
2012-10-26 13:01:09 +02:00
Vo Minh Thu 0537147d95 [IMP] expression.py: added tests for the in/not in operators involving a many2many.
bzr revid: vmt@openerp.com-20121026100819-b2o4q9a082um6p2m
2012-10-26 12:08:19 +02:00