Commit Graph

272 Commits

Author SHA1 Message Date
Raphael Collet 05f176f418 [IMP] ir_ui_view: do not recompute field `model_data_id` on views
The recomputation should not be necessary, as we normally don't change the
record referred by an ir_model_data record.  This speeds up the creation of
ir_model_data records by 33%, which should be noticeable during module
installations.
2015-09-08 14:14:58 +02:00
Nicolas Lempereur cdb9000449 [FIX] website, base: escaping and unescaping html
When saving a template in version 8.0, html would be saved as it should
be displayed once on the site. In particular, if some text should be
escaped once send to the browser, it will be saved as such.

But when rendering, a text node content is unescaped two times:

* for translation which seems wrong since we already use .text of a node
  which already escaped it, doing it one more time is bad,

* when rendering the template, since the html template is stored in xml,

This commit remove superfluous unescaping for translation, and add an
escaping when saving the changed template content.

closes #7967
opw-646889
2015-08-13 15:15:24 +02:00
Alexandre Fayolle 0b74fbed74 [FIX] ir.ui.view: pass context as a kwarg
otherwise when a method such as fields_get is overridden
using the new API, self.env.context is an empty directory,
and the translations cannot be performed correctly

Closes #7911
2015-08-07 02:52:19 +02:00
Nicolas Lempereur 0920c2fae0 [FIX] web: sort tree view by id
Previously, if the ID column was displayed it was not sortable.

The particular case added 247c1972 is no longer needed with the new api,
id is in the list of existing fields (see xmo comment in #7461).

closes #7487, closes #7461
fixes #7459
opw-644009
2015-07-07 12:32:38 +02:00
Xavier Morel d1a19bcb7f [IMP] base: performances of view._check_xml
View validation accounts for a fair cost of module installation, most of
that is spent checking for view validity, and a significant fraction
of *that* is spent reading the validated view from the DB.

Turns out _check_xml requested *all* view fields even though it needed
none of them save for the arch. Specifying fields to read_combined
rather than fetching all fields seems to result in a ~30% speedup of
_check_xml (under line_profiler). Most of the rest is spent fetching
sub-views (in get_inheriting_view_arch), I don't know that it can be
improved without hand-crafting a fairly complex SQL request.
2015-06-25 10:39:55 +02:00
Denis Ledoux cf4d14ce39 [MERGE] forward port of branch saas-3 up to 09b277c 2015-04-27 14:02:52 +02:00
Denis Ledoux d6ae7fb7db [MERGE] forward port of branch 7.0 up to 3e7d3c7 2015-04-27 12:19:43 +02:00
Thomas Rehn e8ffc09b30 [FIX] ir.ui.view (diagram): do not depend on semi-random order of _columns
The ir.ui.view.graph_get() method depended on the natural
semi-random order of Python dict keys in the _columns dict.

When the number and/or names of the _columns happened to
yield the o2m field of the "incoming transitions" *before*
the "outgoing transitions" of the "Node model"
(e.g. workflow activity), it would swap the incoming and
outgoing transitions fields around, causing a crash later
in the `tools.graph.process` method (currently an infinite
loop in the `tree_order()` method of tools.graph.py).

Closes #3614
Fixes https://bugs.launchpad.net/openobject-server/+bug/1316948
opw-633765
2015-04-24 13:50:26 +02:00
Christophe Simonis d6998061f1 [FIX] base: correct custom views validation.
As custom views validation is done while `self.pool._init` is set,
filter on currently loaded modules was still applied.
As a side effect, only one custom view per base view was validated.
In case this view is depending on another custom inherited view, the
validation failed.
Now force loading all views when validating custom views.
2015-03-04 12:49:06 +01:00
Christophe Simonis 325de62f51 [FIX] base: correct inheritance application
While `apply_inheritance_specs` apply most of its changes inplace, it may
completely replace the `arch_tree` if the root node is replaced.
This new root node wasn't used for `primary` views that inherit from
another.
2015-03-04 12:43:22 +01:00
Goffin Simon cbb51610ee [FIX] ir.ui.view: qweb translations: allow looking up translation in parent template
- Translations lookup normally uses the namespace of the current
QWeb template, after merging all inherited views.
But when a QWeb template is "cloned" by a child view using
inheritance with `primary` mode, the translations are more
likely to exist for the original (parent) template, and would not
be found when using only the "child" namespace.
This patch adds support for looking up each translation
also in the parent namespace in this case, if none was found
for the child template in the first place.

- ir.translation's _get_source() now supports a list of res_id
to search for, in addition to a single res_id

- Also moved the logic of routes /website/customize_template_get
and /website/get_view_translations to the ir.ui.view model where
it belongs.

opw: 615241

Closes #5325
2015-02-24 14:01:34 +01:00
Antony Lesuisse 06c681ba11 [FIX] base: add env to ir_action and ir_ui_view qweb context
To impel new api usage in server actions and qweb templates.
2015-01-28 23:48:23 +01:00
Martin Trigaux dd558c40b8 [FIX] base: translation of terms in inherited view
If a view inherits from another with a different model (typically
product.product view inherits from product.template view), the terms from
the second view were not translated.
Checking on the parent view in case of different model and look up the terms
on this model.
Fixes some of #1755, opw 621512
2015-01-08 12:01:09 +01:00
Olivier Dony e5f7b56735 [FIX] ir.ui.view: deletion of parent view should not cascade
This is safer to avoid inadvertently dropping customizations,
and does not impact the normal update/uninstall process, which
is based on the dependency order.
2014-11-25 18:38:39 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Christophe Simonis 2e3f59181d [MERGE] forward port of branch saas-3 up to db75994 2014-10-14 15:13:14 +02:00
Olivier Dony 4202ea7c19 [FIX] ir.ui.view: creating custom views in backend did not compute view type
When creating new records in backend all field values are
sent to the server, including empty fields.
2014-10-07 13:12:38 +02:00
Xavier Morel 494dcbd0e3 [IMP] qweb doc, tests
* document qweb based (mostly) on JS version
* convert JS qweb tests to (mostly) language-independent XML so they can be
  used for JS and Python implementations
* add some more tests (e.g. precedence between t-value and body in t-set)
* remove ``t-import``
* fix parity in foreach(dict) (and rename some variables to make array and
  object versions more similar)
2014-10-06 19:13:43 +02:00
Fabien Meghazi 0084646475 [IMP] Refactor ir.ui.view's read_template cache invalidation 2014-09-17 15:52:47 +02:00
Denis Ledoux 47c3205229 [FIX] ir_ui_view: Active (boolean) should not be required
If so, impossible to uncheck the box in the webclient
2014-09-17 13:55:00 +02:00
Olivier Dony 3caafac8c0 [FIX] ir.ui.view: match translated terms without heading/trailing whitespace
As the whitespace is stripped when exporting terms
to translate, it must be done as well when matching
translations at runtime.

Fixes issue #1755 partly
2014-09-16 17:46:25 +02:00
Xavier Morel 7558e2e786 [IMP] distribute branding on @groups instead of disabling edition
Avoids 2 rendering passes, and allows editing e.g. events detail page, which
couldn't be done (due to groups=public in a mail component)

fixes #1994
2014-09-08 11:16:06 +02:00
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
Fabien Meghazi c0132100ce [FIX] website translation bug
Sometimes a node can't be translated using the website Translate
mode. The translation is added to the Application term list but
the id of the view is not correct.

This happen when a translatable node is a children of a inherited
node whose branding could not be kept. data-oe-source-id was left
over because it was not registered in MOVABLE_BRANDING
2014-08-20 17:16:29 +02:00
Olivier Dony 868a77616d [FIX] ir.translation: export/import of QWeb terms
Fixes the translation term import/export logic to
support terms inside QWeb templates.

Refactored a bit the export code so the babel-based
QWeb terms extractor for ./static/src/*.xml files
uses the same logic as the regular extractor for
ir.ui.views with type QWeb.

Server-side QWeb rendering uses a mix of the native
 view inheritance mechanism and the template inclusion
(t-call) mechanism. During rendering the translations
are only applied at "template" level, *after* the
view inheritance has already been resolved.
As a result translations are local to a template,
not to the inherited view in which they are actually
written.
In terms of exporting PO[T] files, this is done by
resolving the "root" QWeb template a view belongs
to, and using it as the location of the translated term.

During import there is one extra quirk for QWeb
terms: they need to be linked to the `website` model
rather than the actual `ir.ui.view` model they
are really pointing to, so the rendering phase can
properly recognize them.
2014-08-13 11:08:02 +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
Fabien Meghazi 4042135bc4 Merge remote-tracking branch 'odoo/master' into master-sass-in-bundles-fme 2014-07-01 14:26:40 +02:00
Fabien Meghazi a49ebae676 [IMP] Lazy module_boot() loading
Removed 'modules' item in ir.ui.view rendering context.
Replaced by lazy helper get_modules_order
2014-07-01 14:22:56 +02:00
Fabien Meghazi 9fa77980d7 Merge remote-tracking branch 'odoo/master' into master-sass-in-bundles-fme 2014-06-27 19:40:02 +02:00
Fabien Meghazi 0d1d225249 Remove ir.ui.view last_update collection and use checksum on rendered bundle 2014-06-26 18:18:12 +02:00
Christophe Simonis 1eaa69d342 [MERGE] forward port of branch saas-5 up to 9e8e365 2014-06-25 12:44:13 +02:00
Christophe Simonis 9e8e3653f2 [MERGE] forward port of branch saas-4 up to f68c835 2014-06-25 12:43:41 +02:00
Christophe Simonis f68c83545a [MERGE] forward port of branch saas-3 up to a66f3dd 2014-06-25 12:33:17 +02:00
Fabien Meghazi aa97aaa9d7 [ADD] Assets Bundle versioning and better cache handling
An asset bundle is now versionned with the dates of the
ir.ui.views that compose it and also with the dates of
the files and ir.attachments linked inside the bundle.

This new behavior is reflected in the bundle's lru cache
managment.
2014-06-24 18:52:38 +02:00
Denis Ledoux 8e83dbff5d [MERGE] Forward-port of 7.0 bugfixes up to 7d3453d119 2014-06-24 12:27:09 +02:00
Fabien Meghazi daf8bdf688 [ADD] support for multiple value query args in keep_query() 2014-06-17 11:35:29 +02:00
Fabien Meghazi ba3ce4753b Set form views default @version="7.0" 2014-06-11 14:03:20 +02:00
Xavier Morel b973e27da5 [IMP] views: don't prevent always -> disabled writes in views, is confusing and not very useful 2014-06-05 12:22:37 +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 abc50d1041 [IMP] application field doc 2014-05-27 12:26:38 +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 9555b32c7b [IMP] add some more explanations for the behavior of the mode attribute on views 2014-05-27 12:20:04 +02:00
Xavier Morel e06f5b414b [IMP] inherit_option_id -> application 2014-05-27 12:13:51 +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