summaryrefslogtreecommitdiff
path: root/odoo/tools/view_validation.py
AgeCommit message (Collapse)Author
2020-07-14[IMP] web: improve eval context datesJulien Mougenot
This commit handles 2 things: 1) the merging of the `py_utils.context()` into the evaluation context returned by `BasicModel._getEvalContext` to access the same time-related keys, 2) the addition of 2 new keys into the `py_utils.context` (thus transmitted to the basic model): `today` (an alias for the already present `current_date`) and `now` which represents the current date and time value. Task 2269697
2019-11-21[IMP] core: simplify get_domain_identifierXavier Morel
* we can just get the variable names once for the entire expression, no need to bother doing it bit by bit * avoid blowing up when the domain contains computations *around* segments. closes odoo/odoo#40642 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-11-20[IMP] core: view validation error reportingXavier Morel
* allow chaining tracebacks of exceptions when using view validation in order to provide better issue location * provide actual error messages in get_domain_identifiers to pinpoint issues better than "expression is not a valid domain" which depending on the domain might not make it entirely clear *why* the expression is not a valid domain closes odoo/odoo#40468 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-11-18[IMP] tools: make domain validation less strictRaphael Collet
We do not want to block developers from using dynamic domains like: domain="country_id and [('country_id', 'in', [False, country_id])] or []" closes odoo/odoo#40445 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-11-13[REF] base: refactor check_xml and read_combinedXavier-Do
View creation/edition represent a important part of an install and a lot of possible view errors are not detected, like fields used in domain filters. Some part of the code a difficult to maintain, and view checks are splitted in multiple places. This commit aims at refactoring view validation by regrouping most part of the logic in ir_ui_view and trying to optimize the overall process. Since most of the lines were touched, this task was also an opportunity to modernize the API. Main changes on method `check_xml`: - extract node processign and validation to individual postprocessor - add validation for filter node, buttons, ... - fix accessibility checks (and improve their performance) - move xpath check to specific Python node validator - clarify error messages (wip to continue) Main changes on method `read_combined`: - optimize the search for inheriting views in a single query doing the whole recursive search Indeed, after removing xpath validations, `get_inheriting_views_arch` was the most expensive method in `check_xml`, spending most of the time in `search` because of recursive calls to retrieve children views. The view Backend Assets is a good example of the latter point, since a line is added in the view for almost every module. 70 views (community) are added at first level, `get_inheriting_views_arch` is efficient and returns all 70 views. Then at the second level, the method `get_inheriting_views_arch` is called 70 times for nothing. 70 calls to `search` (squared/2 since each view is checked independently) are almost useless. The same case applies to the settings view. As a result, the average module installation time is 25% faster, and the average time spent in `read_combined` is almost divided by 2.
2019-10-30[FIX] core: remove broken time consuming checksfw-bot
The two method valid valid_alternative_icon_text and valid_title_icon represent ~13% of an install all. Rewriting them in master with in #36373 is the main reason of the performance improvement. Those two method logic were broken, because `xpath += '[not(//*[' + valid_attrs_xpath + '])]'` will actually search for valid_attrs_xpath from view root, not from fa- node. -since this check will only log a warning and so only impact bugfix, no impact on user editing views, -since a new check is added in master with the corresponding fix in views, -since this check doesn't really test what it is suppose to check, -since fa accessibility is great, but not critical ->removing those check will slightly speed up build without major impact on views quality closes odoo/odoo#39566 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-09-10[REM] web_diagram: remove unused moduleXavier-Do
closes odoo/odoo#36638 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-08-12[IMP] base: extract gantt validationjem-odoo
All views defined in the 'enterprise' addons have their validation done manually in their respective addons. Each one ? No, one rebel still resists to the standart way to work. This commit moves the gantt validation to put it in its module. The idea is (for developper) to have only one module to change when adding feature in gantt view. Task-2050019
2019-08-07[IMP] *: fix typos in commentsmreficent
closes odoo/odoo#35404 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-19[IMP] base,web*: searchpanel in all multi record viewsLucas Perais (lpe)
Before this rev. the searchpanel could only be activated in kanban views (and it was specified in the kanban arch). From now on, the searchpanel can be activated in any multi record view. It's arch is moved to the search view arch (inside the <searchpanel> tag). Task 1985921 Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-05-03[IMP] base,mail: allow to customize the activity viewHiral Bhavsar
The activity view has been greatly improved to allow to customize it more easily. It works quite similarly to the kanban view, defining `<field>` tags at the top and using these fields in the `<template>` section. The template name used to define the activity cards is `activity-box`. Note that these activity cards are rendered using `KanbanRecord` widget (this has implied that ActivityView inherits from `BasicView`). Also note that the view validation has been moved in base to include the common grammar. Task 1894990
2019-04-02[IMP] web,base: put buttons in list group headersMartin Geubelle
It is now possible to put buttons in the list view group headers. When the view is grouped by a many2one field, those buttons appear next to the header title when the group is opened. The buttons are specified in the views in a <groupby> tag in the list arch, with the following structure: <groupby name="groupedField"> <!-- must be a many2one --> <button type="object" name="my_method" string="Button1"/> </groupby> It is also possible to add `field`, inside the `groupby` which can be used for modifiers. These fields thus belong on the many2one comodel, like: <groupby name="partner_id"> <field name="name"/> <!-- name of partner_id --> <button type="object" name="my_method" string="Button1" attrs="{'invisible': [('name', '=', 'Georges')]}"/> </groupby> These extra fields are fetched in batch when grouping on the field. Part of task 1915702
2018-07-17[IMP] web: add control + create tags to customize "add a line"Sébastien Theys
The default "add a line" button creates a new line with the default values from the model. Sometimes we want to create a new line with different default values (or more generally a customized context), which is possible with this commit. Moreover it is possible to create multiple buttons for multiple default values/contexts. This works both for in-line creation ("editable=") and dialog creation. The new tags are: <control> defines custom controls for the current view. Does not support any attribute, but can have children: <create> adds a button to create a new element on the current list. This makes sense when the parent tree view is inside a One2many field. If any create is defined, it will overwrite the default "add a line" button. For more information and example, have a look at the Views documentation. Technically, the commit will: - parse the new XML tags (+ add appropriate validation) - display the buttons based on the XML - on button click/keyboard: pull up the additional context information from the button event up to the default_get - add unit tests - add documentation PR #25209
2018-07-04[FIX] Syntax of icons (#25577)kujiu
Description of the issue/feature this PR addresses: Accessibility improvements forbids the use of the syntax `<i class="fa fa-check"/> Some text` to create a labelled icon. But, by this, some fonts are changed. Desired behavior after PR is merged: The old syntax can be used.
2018-06-22[IMP] Improve compatibility with screen readers (accessibility) (#24574)kujiu
Today, Odoo is really tricky to use without seeing the screen, it must be improved to be usable. This PR forbid to use labels without a "for" attribute, add some title, rule and aria attributes in HTML. With that, Odoo will be fully usable with a screen reader. * [IMP] Labels must have a for attribute. Improve accessibility. * [IMP] Better error message when trying to read a missing cached value * [FIX] Add some aria-label and title attributes for screen readers. * [FIX] Template name is not included in the error message in case of SyntaxError in QWeb * [FIX] Improve the Tour failed at step error message to be more explicit. * [IMP] Add aria-labels * [FIX] Add missing aria-label on failing test * [IMP] aria-hidden means hidden. Fix all bad aria-hidden and hide aria-hidden for all. * [IMP] Color names on kanban views and many2many tags * [IMP] Add some checks on views for accessibility. * [IMP] Add `alt` attribute on `img` tags. * [IMP] Add aria-label and title on non-described icons * [IMP] Add button role to widgets with btn class * [IMP] Translate aria and formatted attributes. * [IMP] Remove wrong aria-labelledby * [IMP] Add menu role on dropdowns * [IMP] Buttons must be focusable * [IMP] Add aria attributes on progress bars * [IMP] Improve accessibility of basic widgets * [IMP] Change main layout to more semantic tags * [IMP] Add menuitem role when missing * [IMP] Remove wrong role='presentation' * [IMP] Improve accessibility of tab panels * [IMP] Add aria-invalid on invalid fields * [IMP] Add aria-sort on ordered columns * [IMP] Add role on alerts * [IMP] Use dialog role, header, main and footer tags for modals * [IMP] Add labels on o_status * [IMP] Improve accessibility of kanban view with feeds and articles * [IMP] Add alerts in case of new messages * [IMP] Add widget, navigation or img role to aria-labelled items
2017-09-14[IMP] base: improve view rng validation (#17902)Mitali Patel
Split big universal RNG into view-specific schemas and moved rng based view validation into view_validation.py file. Adapt old views, and remove deprecated tag `version="7.0"` from views.
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet