Jeremy Kersten
3a1c693259
[FIX] osv: fix boolean in domain for custom field
...
When a new column has been added after that some data already exists,
the old lines will keep an empty/null value. So when we search is the new field
is equals to False or if it is different of True, we need to match the null
values.
Backport of de3b64018a
2015-12-04 18:22:32 +01:00
Raphael Collet
c28a28e69e
[IMP] osv: use iteration for expression negating
...
The current code when applying negative operator on an expression used
recursion which in extreme case is not best friend with python.
e.g: on instance with a lot of wharehouse, some simple action could lead
to a domain with lot of elements which could easiliy go over the python
maximum recursion limit.
This commit fixes this by replacing recursion with iteration.
We have a stack of negation flags and loop on each token of the domain
as follow :
- when we iterate on a leaf, it consumes the top negation flag,
- after a '!' operator, the top token negation is inversed,
- after an '&' or '|' operator, the top negation flag is duplicated on
the top of the stack.
closes #9433
opw-653802
2015-11-05 17:13:28 +01:00
Olivier Dony
6acd5ef91c
[FIX] expression: internal domain operators require different parsing
...
Ensure the absence of internal domain operators is correctly
propagated throughout the domain parsing.
2015-06-23 15:04:45 +02:00
Denis Ledoux
54a90179bb
[FIX] expression: ensure tuple to compare leaf with TRUE/FALSE leaf
...
When setting a custom filter with as domain
[(0, '=', 1)]
the domain was rejected, because (0, '=', 1) wasn't
considered as a valid leaf, while it is.
This is because the Javascript converts this domain
using list instead of tuple
[(0, '=', 1)] -> [[0, '=', 1]]
And therefore, comparing the "list" leaf
to the TRUE/FALSE leaf tuple failed.
Ensuring "element" as a tuple solves the issue.
opw-640306
2015-05-20 15:33:35 +02:00
Mohammed Shekha
0b593ada11
Server Translation: Fixed the issue search on translated field do not return true result, search on tranlsated field fails due to expression parsing which fetches ids from ir_translation as well as working table and UNION of this makes search fruitless, also search fails for in language other then english when you enter part of a string for the field to search.
2014-06-24 17:42:48 +05:30
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
6fca27626a
[FIX] expression: do not double quote column names
...
bzr revid: chs@openerp.com-20140403084524-9rb174osjrbmhgwc
2014-04-03 10:45:24 +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
Christophe Simonis
dfe28ec31f
[FIX] expression: use unaccent() for translated search
...
lp bug: https://launchpad.net/bugs/1049653 fixed
bzr revid: chs@openerp.com-20140331123012-dq3hsw2bc368zvgq
2014-03-31 14:30:12 +02:00
Martin Trigaux
f2b2ee8eae
[FIX] expression: do not look at translation in parse when searching with empty string or false
...
This fixes traceback when applying filter 'is not set' on a translatable field
lp bug: https://launchpad.net/bugs/1208565 fixed
bzr revid: mat@openerp.com-20140127144913-qjh9hrnkfdn18sdb
2014-01-27 15:49:13 +01:00
Christophe Simonis
7f8b6542f0
[FIX] expression: allow exclusion of records with translated fields
...
lp bug: https://launchpad.net/bugs/1071710 fixed
bzr revid: chs@openerp.com-20140108152722-7f0dpsuv1skxbqub
2014-01-08 16:27:22 +01:00
Christophe Simonis
9675445dee
[FIX] expression: allow exclusion of records with translated fields
...
Manual forwardport of revid 4369 chs@openerp.com-20140107112227-sc1ssd1dw404vcz2 of 6.1 branch
lp bug: https://launchpad.net/bugs/1071710 fixed
bzr revid: chs@openerp.com-20140107130840-igmm8sy03nrm5d5f
2014-01-07 14:08:40 +01:00
Christophe Simonis
03381c761d
[FIX] expression: a valid leaf must have a non empty string as first element or be the magic TRUE_LEAF/FALSE_LEAF
...
lp bug: https://launchpad.net/bugs/1197323 fixed
bzr revid: chs@openerp.com-20130719091903-28ez0txxyjh6qiii
2013-07-19 11:19:03 +02:00
Martin Trigaux
8ecd022348
[IMP] clean permissions and shebang in files
...
bzr revid: mat@openerp.com-20130514103333-puuj4kmxq3bwzwec
2013-05-14 12:33:33 +02:00
Christophe Simonis
60f0bd08ee
[FIX] expression: allow creating child_of expression even if "id" field has been redefined, courtesy of Gustavo Adrian Marino
...
lp bug: https://launchpad.net/bugs/1030942 fixed
lp bug: https://launchpad.net/bugs/1131992 fixed
bzr revid: chs@openerp.com-20130423181926-yk628txd6yiybtko
2013-04-23 20:19:26 +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
Quentin (OpenERP)
d97916a063
[IMP] expression.py: added a clue to debug fuzzy tracebacks related to domain badly written
...
bzr revid: qdp-launchpad@openerp.com-20130306152328-qdlil19diks4mvkt
2013-03-06 16:23:28 +01:00
Raphael Collet
39fe69babe
[FIX] expression: avoid delitem on a tuple
...
bzr revid: rco@openerp.com-20121217134559-cjc0b4ncs1drupn7
2012-12-17 14:45:59 +01:00
Xavier Morel
d0a377cb1c
[FIX] incorrect docstrings or docstring param names not matching actual param names
...
bzr revid: xmo@openerp.com-20121214130758-a2wp963w4djmb02k
2012-12-14 14:07:58 +01:00
Xavier Morel
c6079dd6bb
[REM] unnecessary parens
...
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
2012-12-14 13:38:03 +01:00
Thibault Delavallée
9381a82715
[IMP] Added an assert on the alias length.
...
bzr revid: tde@openerp.com-20121207160933-1ivbkkv6tgg5a7x3
2012-12-07 17:09:33 +01:00
Thibault Delavallée
50cf6d4008
[CLEAN] Query: cleaned a bit the code. All joins now goes through the same method, either implicit or explicit. Will have to be upgraded in future versions, but at least this is a bit centralized. Updated ORM accordingly. Updated tests. Added a get_alias_from_query method in expression that find the table and the alias from a 'full alias' statement.
...
bzr revid: tde@openerp.com-20121207154204-mx036lpj3vdclu77
2012-12-07 16:42:04 +01:00
Thibault Delavallée
390ff1540f
[CLEAN] expression.py: cleaned and added comments, var names (table -> model notably).
...
bzr revid: tde@openerp.com-20121207123727-md65da41863y827e
2012-12-07 13:37:27 +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
bb57752f0a
[IMP] [CLEAN] [REVIEW] expression: udpated domain management. Added pop and push methods in parse to hide the internal plumbery. Cleaned some comments, deleted dead/unnecessary code, updated some comments. to_ids and childof_domain back in parse. Added generate_table_alias, method that should be used everywhere if possible when generating table name or aliases for sql conditions and things like that.
...
bzr revid: tde@openerp.com-20121206162128-1qol201os1xztlz5
2012-12-06 17:21:28 +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
df4665fcd2
[IMP] [CLEAN] [REVIEW] field._properties -> isinstance(field, fields.function).
...
bzr revid: tde@openerp.com-20121206091648-vmy2ghr293reoxn6
2012-12-06 10:16:48 +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
681d783234
[IMP] expression.parse: added some asserts about non supported cases.
...
bzr revid: tde@openerp.com-20121129165032-nnlnf1k0iwal24ny
2012-11-29 17:50:32 +01:00
Thibault Delavallée
47fda82264
[FIX] expression.parse: fixed indentation error preventing leafs to be correctly replaced in auto_join.
...
bzr revid: tde@openerp.com-20121128181258-cgmm7wqgv657iptb
2012-11-28 19:12:58 +01:00
Thibault Delavallée
ac587f68fe
[IMP] expression.py: added support of _auto_join in parse. The purpose is to add join clauses to queries instead of replacing many2one or one2many fields by id in ... equivalent leafs. This should lessen the number of executed queries, as well as the time required for some queries like mailboxes queries. Updated the generation of full table aliases when generating SQL, to avoid having a table having it own name as alias.
...
bzr revid: tde@openerp.com-20121128095042-x5rzgwydv0g9uy0m
2012-11-28 10:50:42 +01:00
Thibault Delavallée
9b196638cb
[IMP] expression: replaced field paths now use an alias.field leaf style to prepare the inclusion of joins. In leaf_to_sql, handle this case accordingly.
...
bzr revid: tde@openerp.com-20121127170117-qlhfs0r1ned5uz3c
2012-11-27 18:01:17 +01:00
Thibault Delavallée
873d6cd5b1
[CLEAN] expression.py: self.__exp -> self.exp, because too much underscores kill my eyes. Added a bit of comments. Please note that the behavior has still not changed.
...
bzr revid: tde@openerp.com-20121127164531-hbsyhshmefdw0f93
2012-11-27 17:45:31 +01:00
Thibault Delavallée
07f26441bb
[IMP] expression.parse: improved code about extracting inherits\'d fields. I do not like while True statements, I prefer having a clear condition. Behavior should still be the same as before.
...
bzr revid: tde@openerp.com-20121127163758-tddhbglygcbkvzed
2012-11-27 17:37:58 +01:00
Thibault Delavallée
48138c9d26
[IMP] [DOC] expression.py: renamed field_obj to relational_table, that make more sens to me. Added comments in the code to understand the algorithm. Please note that currently, no logic has been altered.
...
bzr revid: tde@openerp.com-20121127163014-5ww5mre6j7opmzp1
2012-11-27 17:30:14 +01:00
Thibault Delavallée
53efed664d
[IMP] expression.py: _leaf_to_sql now uses a table_alias instead of table._table for query generation. Currently table_alias equals table._table, so the behavior has not changed.
...
bzr revid: tde@openerp.com-20121127161354-fskwsmfvx3j8nto6
2012-11-27 17:13:54 +01:00
Thibault Delavallée
e147a5483f
[CLEAN] expression.py: table_aliases now holds a list of aliases (names), and table_aliases_mapping does the mapping between a name and a table. The parsing algorithm now uses some accessors instead of directly accessing the data structures.
...
bzr revid: tde@openerp.com-20121127151113-zregov1i2isoll9z
2012-11-27 16:11:13 +01:00
Thibault Delavallée
c1c5a85231
[CLEAN] expression.py: renamed some variables of expression; cleaned a bit the coding style (mainly spaces after commas).
...
bzr revid: tde@openerp.com-20121127150159-su9x00m7tc8tc6dj
2012-11-27 16:01:59 +01:00
Olivier Dony
361c0acd2a
[FIX] expression: negative operators (e.g. NOT IN) where not working on o2m fields - tests added
...
bzr revid: odo@openerp.com-20121018124750-bkea51a7zkvwwygi
2012-10-18 14:47:50 +02:00
Xavier Morel
aaff4459c4
[DOC] fixes and cleanups
...
bzr revid: xmo@openerp.com-20120928065654-jj3ot17dz8vd3wum
2012-09-28 08:56:54 +02:00
Xavier Morel
ef26faf0a5
[IMP] add more information when searching on a non-searchable field using debug logging
...
bzr revid: xmo@openerp.com-20120802152553-r8xpw0g6bep08jod
2012-08-02 17:25:53 +02:00
Xavier Morel
8060f19108
[IMP] error-level log when non-stored function field without fnct_search is searched
...
holding off on blowing up an error just yet, but it might be a good idea in the end
bzr revid: xmo@openerp.com-20120802150837-3qvgg3e5pmfeqmk0
2012-08-02 17:08:37 +02:00
Vo Minh Thu
f22f2fc770
[IMP] openerp.{modules,osv}: _logger with fully qualified module name.
...
bzr revid: vmt@openerp.com-20120124124252-91g3ysf33zsq4nhd
2012-01-24 13:42:52 +01:00
Olivier Dony
c68045e497
[FIX] expression: properly care for implicitly defined m2m fields used in search() domains
...
Now that m2m fields may be defined without explicitly
specifying the name of the relationship table and its
foreign key columns, all access to these internal
names should be done via m2m._sql_names().
This seems better than lazily initializing these
internal names and hoping that nothing accesses
them before the init.
bzr revid: odo@openerp.com-20120119151012-c38k5zl7rqherhth
2012-01-19 16:10:12 +01:00
Vo Minh Thu
b00473034a
[IMP] typo.
...
bzr revid: vmt@openerp.com-20111109123042-9vtfp6uv7qsgy4pz
2011-11-09 13:30:42 +01:00
Olivier Dony
4140e3546a
[FIX] expression: proper handling of empty string in m2o domain criterions
...
Also fixed incorrect name_search() implementations in
res.partner and res.currency, and added corresponding
tests.
lp bug: https://launchpad.net/bugs/861350 fixed
bzr revid: odo@openerp.com-20111011163435-szj9vm6x9x8nryn8
2011-10-11 18:34:35 +02:00
Vo Minh Thu
25a883b2aa
[FIX] expression: we dont add any restriction on the main ids
...
as the possible active=True/False is already present in the main domain.
bzr revid: vmt@openerp.com-20111005133337-p8nvv26tlii7x253
2011-10-05 15:33:37 +02:00
Yogesh (OpenERP)
07121a762b
[MERGE]
...
bzr revid: ysa@tinyerp.com-20111005093709-u3rg6g10rcs7tf8f
2011-10-05 15:07:09 +05:30