Commit Graph

48 Commits

Author SHA1 Message Date
Antony Lesuisse 2d296cb779 [MERGE] ir-ui-view split active and show_customize
Split the ternary field application in active and show_customize, all four
possible value are now needed for the customize theme popup.
2014-08-31 16:56:44 +02:00
Christophe Simonis 5dff035878 [MERGE] forward port of branch saas-5 up to 39bee35 2014-08-20 20:33:17 +02:00
Christophe Simonis 39bee35e25 [FIX] base: correct view branding tests after c013210 2014-08-20 18:23:12 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Xavier Morel e5560a2785 [REM] test for removed 'feature' of refusing always -> disabled writes on views 2014-06-05 16:08:42 +02:00
Christophe Simonis e16233217c [MERGE] Replace inherit_option_id by a selection field (PR #229) 2014-05-27 17:57:33 +02:00
Xavier Morel ab7dd57771 [IMP] make mode handling more regular
Before this commit, @mode=primary would be sorta-ignored[0] if the current
view and its parent had the same model: the current view would *still* get
applied (as an extension) when asking OpenERP for its parent. This commit
makes mode=primary views behave regularly, they are *never* applied when
asking for their parent, only when asking for them or their children.

This allows "forking" views, and using extended views in some contexts without
breaking or duplicating the original view

[0] there was actually a problem when asking for the current view directly,
    first its parent would be resolved by applying it, then it would be
    applied to resolve itself, the view would thus get applied twice (oops)
2014-05-27 12:23:02 +02:00
Xavier Morel 0f5424eac4 [IMP] replace check_mode python-level constraint by an SQL CHECK constraint 2014-05-27 12:21:52 +02:00
Xavier Morel 833f5894d2 [FIX] typos 2014-05-27 12:18:22 +02:00
Xavier Morel e2f41d09ba [IMP] prevent changing a view from application: always to application: disabled
not sure that's actually useful, and can still go always -> enabled -> disabled...
2014-05-27 11:57:07 +02:00
Xavier Morel d82ffb8728 [ADD] application field & check during inheriting views read 2014-05-27 11:57:07 +02:00
Xavier Morel da345aaa2d [ADD] use of explicit primary mode in read_combined 2014-05-27 11:57:02 +02:00
Xavier Morel 4e3dbb96b3 [FIX] default_view should be based on mode=primary, not on inherit_id=False 2014-05-27 11:57:01 +02:00
Xavier Morel 434be479f9 [ADD] mode attribute to views
Not used yet, only defined its relation to inherit_id:

not inherit_id + primary -> ok
not inherit_id + extension -> error
inherit_id + primary -> ok
inherit_id + extension -> ok
2014-05-27 11:57:01 +02:00
Xavier Morel 9cefa76988 [ADD] hasclass() xpath function
Server-side, view extension is done via xpath. This includes "template" views
full of HTML.

HTML elements often have a bunch of classes, sometimes even semantic
(!). XPath is generally great, but specifically lousy at dealing with
space-separated values: in standard XPath 1.0 to know if an element has a
class 'foo' the predicate is:

    contains(concat(' ', normalize-space(@class), ' '), ' foo ')

and this has to be fully duplicated if there's a second class involved.

Things are slightly better with EXSLT/XPath 2.0 and tokenize, but still not
great:

    tokenize(@class, '\s+') = 'foo'

and the equality check is very weird when unaware of XPath's evaluation rules.

``hasclass`` makes this much simpler to deal with: to get any ``foo`` node
with the class ``bar`` is as simple as:

    //foo[hasclass('bar')

and it can take multiple class, as with e.g. jquery it will return elements
with all specified classes.

Beware though, the predicate function will be called once for each element to
check, since it's implemented in pure python and not profiled elements should
be filtered as much as possible before this point.
2014-05-19 08:32:23 +02:00
Raphael Collet b49f536baf [IMP] tests.common: turn class methods into instance methods (this will ease some future refactoring)
bzr revid: rco@openerp.com-20140408114936-jfagg4qvft8bk3ms
2014-04-08 13:49:36 +02:00
Xavier Morel a67cd4c049 [FIX] t-ignore should remove injected sub-view branding below the ignore flag
bzr revid: xmo@openerp.com-20140225114706-j8q44cubs59tuwby
2014-02-25 12:47:06 +01:00
Xavier Morel 1b2be9be76 [IMP] unbrand t-raw and t-esc as keeping them branded makes very little sense
they can't be edited in any situation

bzr revid: xmo@openerp.com-20140225110046-90rdevm13pp4m51s
2014-02-25 12:00:46 +01:00
Xavier Morel cf702eb1c6 [IMP] in view tests, replace tostring() and string comparisons by custom lxml.etree comparator
bzr revid: xmo@openerp.com-20140225092842-sc6whhm173azurtt
2014-02-25 10:28:42 +01:00
Xavier Morel 198640434f [FIX] injected views need branding distribution too
forgot to set it up after installed injected view skipping during distribution of injectee

bzr revid: xmo@openerp.com-20140224170301-b4ta04zqsd5d2956
2014-02-24 18:03:01 +01:00
Xavier Morel 325ad57a00 [FIX] branding distribution to generate correct xpath even after injection of inherited view contents
bzr revid: xmo@openerp.com-20140213164546-xor2k3tat8d216wq
2014-02-13 17:45:46 +01:00
Olivier Dony c3c0705203 [FIX] ir.ui.view: fix tests after refactoring of ir.ui.view/qweb view processing
bzr revid: odo@openerp.com-20140130154354-6xg4mx31to4dg0ql
2014-01-30 16:43:54 +01:00
Xavier Morel 0546993327 [FIX] merge from trunk and fix handling of view inheritance
main problem, view inheritance model field would use model from the
root view (after following inherit_id links) rather than the base view
(the requested one) -> with divergent models, it was possible for the
requested view itself to never be returned.

bzr revid: xmo@openerp.com-20131212134422-uxg6h21w1jhth9ow
2013-12-12 14:44:22 +01:00
Xavier Morel 00b012c01b [ADD] tentative tests for application of view inheritance stuff
bzr revid: xmo@openerp.com-20131212120600-timum4yzr84kl0mf
2013-12-12 13:06:00 +01:00
Xavier Morel ebc6ff5256 [REM] broken tests
weird tests (using broken views, but not just broken in the way the
test expects) were really testing for error on using a field which
does not exist, predicated on full rendering of the view during
validation.

This has been removed from the website branch as it's unfeasible and
nonsensical for model-less views (e.g. qweb), and thus the test blew
up with a completely different error (missing @string) or, once the
test was fixed, wouldn't blow up at all.

bzr revid: xmo@openerp.com-20131211162412-t31bxkpy2yzdnf0q
2013-12-11 17:24:12 +01:00
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Christophe Simonis d67ff9ba02 [FIX] views inheritance: deleting a non-existing attribute must be a no-op
bzr revid: chs@openerp.com-20131108175750-yenql6hycpn95i9j
2013-11-08 18:57:50 +01:00
Xavier Morel e5d67ad2e0 [REM] broken tests
expectation of view validation errors when creating view referencing
non-existent fields or models, but in website branch models and views
have become independents, these are not context-free errors anymore.

Also fix shit code.

bzr revid: xmo@openerp.com-20131007093328-gjrktqbsoe48ikol
2013-10-07 11:33:28 +02:00
Thibault Delavallée 54933118a4 [MERGE] Sync with trunk until revision 4957.
bzr revid: tde@openerp.com-20131002133820-8xomdumexexqp3pk
2013-10-02 15:38:20 +02:00
Christophe Simonis e9980e8725 [FIX] test_views: update matching error message
bzr revid: chs@openerp.com-20130918212216-libtu7zpsn2768j0
2013-09-18 23:22:16 +02:00
Christophe Simonis 7081038378 [IMP] validate custom views at the end of update of database
bzr revid: chs@openerp.com-20130912182926-3lectt8mvd9smwfb
2013-09-12 20:29:26 +02:00
Christophe Simonis 1d91378ce2 [FIX] ir.ui.view: properly validate newly created inheriting views
When a new inheriting view is imported during a module
    installation, it is validated thanks to the _constraints
    on the ir.ui.view model. However the validation uses
    a rather convoluted system for validating the whole
    view tree at once (root view + all inherited changes)
    while only taking into account the views that belong
    to modules that are currently loaded.

    This complicated system is necessary to be able to
    operate on-the-fly at any point during the registry
    loading/initialization.

    Now because _constraints are checked during create()
    this particular validation happens *before* the
    external ID (ir.model.data entry) of that new view
    can be created (it obviously needs to wait until
    the view record is inserted). As a consequence the
    view validation cannot determine the module to
    which that new view belongs, and was erroneously
    ignoring it.
    Changing the view filtering to also include views
    that have triggered this check.
    Manually created views are not check during registry
    update.

bzr revid: chs@openerp.com-20130912141018-qmcyase8zqov9d01
2013-09-12 16:10:18 +02:00
Xavier Morel 85a3d8eaeb [FIX] moved view.save to website, forgot to move tests
bzr revid: xmo@openerp.com-20130910132638-2v4ilmi5uuboazt9
2013-09-10 15:26:38 +02:00
Xavier Morel db5e36efa3 [FIX] rewrite ir_ui_view.save with new semantics, xpath fixes
since lxml provides built-in tools to generate the path for a node in a tree, don't reimplement it manually

bzr revid: xmo@openerp.com-20130812074509-yopeb4pxtsads4d9
2013-08-12 09:45:09 +02:00
Vo Minh Thu 7786d96095 [FIX] ir_ui_view: restore the inheritance mechanism for model-specific inheritance:
A view for a given model can inherit from a root view specified for
another model. When applying the modifying views to the root view,
only the views with the same model as the child view must be
considered. This patch restore that behavior.

bzr revid: vmt@openerp.com-20130701145334-ojp1plqjveym7cj7
2013-07-01 16:53:34 +02:00
Vo Minh Thu f42bcfa0f8 [FIX] ir_ui_view: does no longer provide root_ancestor(), so removed corresponding test.
bzr revid: vmt@openerp.com-20130701114129-03jtrx0g6abk6xev
2013-07-01 13:41:29 +02:00
Vo Minh Thu 3b4ecbf033 [FIX] ir_ui_view: it seems the iter() method is no longer there, removed the test..
bzr revid: vmt@openerp.com-20130701112930-k8rhlvgbaj1y1zl5
2013-07-01 13:29:30 +02:00
Vo Minh Thu aba5593f01 [FIX] ir_ui_view: get_inheriting_views_arch() does no longer take a model.
bzr revid: vmt@openerp.com-20130701112726-600dsa9udm0rt4uj
2013-07-01 13:27:26 +02:00
Vo Minh Thu bd4f503b9b [FIX] ir_ui_view: __view_look_dom_arch() was renamed into postprocess_and_fields().
bzr revid: vmt@openerp.com-20130701110521-muec7xyt7op7bhql
2013-07-01 13:05:21 +02:00
Vo Minh Thu 9ad26be680 [FIX] ir_ui_view: accomodate previously changed apply_inheritance_specs() signature.
bzr revid: vmt@openerp.com-20130701105107-thsi2o2pmeifo338
2013-07-01 12:51:07 +02:00
Xavier Morel a65419b042 [IMP] add tests for apply_inheritance_specs error reporting (to improve later, eg by removing cr, uid, context, ...)
bzr revid: xmo@openerp.com-20130625102800-qpw6m9m5cib1qvu8
2013-06-25 12:28:00 +02:00
Xavier Morel b3ade05f11 [ADD] basic tests on application of inheritance specs
bzr revid: xmo@openerp.com-20130625084857-k72kpvdrvejfragb
2013-06-25 10:48:57 +02:00
Xavier Morel 65e95dae49 [FIX] view inheritance tests: generate valid architectures
bzr revid: xmo@openerp.com-20130625060041-pfgdrnawfwuts2rj
2013-06-25 08:00:41 +02:00
Antony Lesuisse ca163b58db fix check_xml, disable wrong tests
bzr revid: al@openerp.com-20130624160910-zp898ew6va3lergk
2013-06-24 18:09:10 +02:00
Xavier Morel 282a7180ca [IMP] remove SQL definition of ir.ui.view, schema alterations
* Formally make model not required
* Remove idiotic default values on type and arch
* Make type not required (it's a function field!)

bzr revid: xmo@openerp.com-20130426145113-cf0t0xx24lk9mtgs
2013-04-26 16:51:13 +02:00
Xavier Morel 7883944c19 [FIX] restrict number of fields read in model-less view test
model_ids not filtered in regular read, so get semi-random list of ids

bzr revid: xmo@openerp.com-20130425100247-2v043bbgpvcj3pv9
2013-04-25 12:02:47 +02:00
Xavier Morel e30b6edb41 [ADD] model-less fields & views munging thing
bzr revid: xmo@openerp.com-20130425093739-v0kya956yzcy5wp3
2013-04-25 11:37:39 +02:00
Xavier Morel 4923d1b82d [MOVE] ir.ui.view tests inside base tests
bzr revid: xmo@openerp.com-20130424154310-vdygcckrz6jm578p
2013-04-24 17:43:10 +02:00