Commit Graph

667 Commits

Author SHA1 Message Date
Xavier Morel c6079dd6bb [REM] unnecessary parens
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
2012-12-14 13:38:03 +01:00
Xavier Morel a5cb8460c6 [FIX] __init__ can't return values
bzr revid: xmo@openerp.com-20121214122525-bd5207viiz4vqi8x
2012-12-14 13:25:25 +01:00
Xavier Morel 4cb3685f70 [IMP] compare to None by identity
bzr revid: xmo@openerp.com-20121214121638-6k5h0ztg94i4f5t6
2012-12-14 13:16:38 +01:00
Olivier Dony e660b70ecb [IMP] orm: do not warn about missing ondelete cascade rule if ondelete is restrict - that's safe as well
bzr revid: odo@openerp.com-20121212210247-emrz5rf9ewcwdggu
2012-12-12 22:02:47 +01:00
Thibault Delavallée bd0bae6625 [MERGE] Perform auto-join and mailboxes+needaction speed udpate. Server-side branch, holding a refactoring of expression.parse and the addition of _auto_join feature on relational fields.
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, working table management and table aliases generation to them. The parsing is now a simple 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 nested loops and uncontrolled results.

Other modifications :
- updated the generation of order_by to take into account the table now referred using aliases
- updated Query object to use the aliases
- fixed an outstanding bug about _order, now handled as order. This means that putting direct SQL into _order of models will not be supported anymore, because of the computing complexity now that we have multiple joins in queries. The branch holds the patch from Paulius Sladkevičius
- updated and added tests
- added a basic documentation for the freature

lp bug: https://launchpad.net/bugs/1070757 fixed

bzr revid: tde@openerp.com-20121210154652-6sab9usb38i7adlh
2012-12-10 16:46:52 +01:00
Thibault Delavallée f0abd6f49e [MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121210083805-1t45n6xxmptpo28o
2012-12-10 09:38:05 +01:00
Antony Lesuisse 2f1f17ead9 [IMP] fields warning display args to locate them
bzr revid: al@openerp.com-20121209193952-ukk0aie3d8fg18q2
2012-12-09 20:39:52 +01:00
Antony Lesuisse d7d1fe562c [IMP] dbname on localthread for logging
bzr revid: al@openerp.com-20121209034910-0iv3mek8860yts3i
2012-12-09 04:49:10 +01:00
Antony Lesuisse a6700e0e3f [MERGE] multiprocess signaling
trying trunk, feature branch fails with Address already in use

bzr revid: al@openerp.com-20121208210954-pi55sib4x7eyamem
2012-12-08 22:09:54 +01:00
Antony Lesuisse 3d2a09a973 multiprocessing signaling manually backported from 6.1
bzr revid: al@openerp.com-20121208181151-lfy956ysnok5b5hf
2012-12-08 19:11:51 +01:00
Christophe CHAUVET 82b17c82a4 [IMP] Remove completly the OIDS, cause WITHOUT OIDS is activate by default
bzr revid: christophe.chauvet@syleam.fr-20121207162110-75hbq71zc6ufeby9
2012-12-07 17:21:10 +01:00
Thibault Delavallée bb598cd105 [CLEAN] orm: added quote around a forgottent table name; cleaned a bit some code and added comments, removed dead code.
bzr revid: tde@openerp.com-20121207162019-ec1x7a38vw2rrqze
2012-12-07 17:20:19 +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 61a2a82174 [MERGE] Merged branch holding a proposal to solve the generate_order_by issue (see lp:1070757). As requested by Olivier Donny, this fix has been moved into generate_order_by. Deleted previous workaround done in this branch. Patch courtesy of Paulius Sladkevičius
bzr revid: tde@openerp.com-20121207155825-9bjvuxhyr0x937l7
2012-12-07 16:58:25 +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
Christophe CHAUVET 3d3534ca39 [IMP] Don't use WITH OIDS when create a table
lp bug: https://launchpad.net/bugs/1087332 fixed

bzr revid: christophe.chauvet@syleam.fr-20121206163711-5jvrhrg8w5le4zay
2012-12-06 17:37:11 +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 02c200844c [CLEAN] Removed some forgotten print statements.
bzr revid: tde@openerp.com-20121205153535-lfs6yrokyk0wfm0w
2012-12-05 16:35:35 +01:00
Thibault Delavallée ea01dfe9dd [CLEAN] fields.py: added auto_join in one2many and many2one __init__, binded on _auto_join. Added some short explanations in fields.py about the attribute.
bzr revid: tde@openerp.com-20121205153410-07vo3j1c641xgmda
2012-12-05 16:34:10 +01:00
Thibault Delavallée 1652bb1e83 [MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121205092215-g6a8fpxtd1fq3nwn
2012-12-05 10:22:15 +01:00
Vo Minh Thu 93ae934963 [ADD] added comment in _validate() explaining why the context is not passed around when calling _constraints functions.
bzr revid: vmt@openerp.com-20121205082840-2ww34gbs7nl56952
2012-12-05 09:28:40 +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
Olivier Dony b624267457 [FIX] translate,orm: remember local Model [_sql]_constraints, and keep only those when exporting translations
Previously all _*constraints leaked upstream and
downstream, and were duplicated in all the exported
terms for all modules inheriting from a given model.

bzr revid: odo@openerp.com-20121204082947-tdpiu71ryxzuredb
2012-12-04 09:29:47 +01:00
Thibault Delavallée 638fc20618 [MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121130093658-uvm0gbo90su88psh
bzr revid: tde@openerp.com-20121203131657-4gcp4wreylnmw2or
bzr revid: tde@openerp.com-20121204082427-7zdzn6f21xzvxby9
2012-12-04 09:24:27 +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 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
Thibault Delavallée 1bda6f44db [ADD] fields.py: added _auto_join attribute. This attribute will be used to automatically generate join queries, instead of doing sub-queries returning an 'id in' domain.
bzr revid: tde@openerp.com-20121127153432-3ttqm8pmgk3l7a77
2012-11-27 16:34:32 +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 7f5ad72429 [MERGE] Forward-port 6.1 bugfixes up to rev. 4307
rev.4307 = rev-id launchpad_translations_on_behalf_of_openerp-20121125065030-g5if5pybr61la4yj

bzr revid: odo@openerp.com-20121126160320-t2suuik6lhk6wl0x
bzr revid: odo@openerp.com-20121126161836-mv8yymzgbnmif4ve
bzr revid: odo@openerp.com-20121126162023-ejvsapwouyudw6c6
bzr revid: odo@openerp.com-20121126181527-d4yx15372bis77qj
2012-11-26 19:15:27 +01:00
Quentin (OpenERP) 18b7592b8d [FIX] osv/orm: fixed the use of 'order' argument given to a search function in order to allow to order by 'ID DESC' and by '<another valid order> + ID ASC/DESC'
bzr revid: qdp-launchpad@openerp.com-20121121130736-guj7np9nk65zx3o1
2012-11-21 14:07:36 +01:00
Olivier Dony caa51abb34 [MERGE] fields_view_get: avoid messing up selection fields' _domain attributes, courtesy of Stefan Rijnhart (Therp)
lp bug: https://launchpad.net/bugs/1081092 fixed

bzr revid: odo@openerp.com-20121120132230-7xb6d2xxwcgn7ipn
2012-11-20 14:22:30 +01:00
Olivier Dony f0ef9bda04 [IMP] Model.default_get: allows setting user default values of x2m to False (for consistency with write())
bzr revid: odo@openerp.com-20121120131839-1kdzevubi74ibthy
2012-11-20 14:18:39 +01:00
Stefan Rijnhart d924cec182 [FIX] Append view domain (in case of selection widget) to a copy of the field's domain
lp bug: https://launchpad.net/bugs/1081092 fixed

bzr revid: stefan@therp.nl-20121120121936-8b1wiho0q96ckeqk
2012-11-20 13:19:36 +01:00
Christophe Matthieu 248f81277f [FIX] fields.html: behave as fields.text for empty values: store NULL
bzr revid: chm@openerp.com-20121119104332-bqm81nuik6pqsbf9
2012-11-19 11:43:32 +01:00
Thibault Delavallée 8b5a7c49a4 [REM] osv: removed temporary override of raise, added for debug purpose.
bzr revid: tde@openerp.com-20121114112021-trre94clvs8nuo43
2012-11-14 12:20:21 +01:00
Thibault Delavallée d52fdd0ab3 [MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121112160536-63tx1u3c6yr2u8x9
2012-11-12 17:05:36 +01:00
Olivier Dony 2a1381a8af [FIX] orm: make sure superuser mode always bypasses access rules filtering - one case was not covered after recent refactoring
Caused by refactoring in rev.4200
revid:odo@openerp.com-20120618094327

bzr revid: odo@openerp.com-20121112120453-axiul7k6y0o67hgb
2012-11-12 13:04:53 +01:00