Commit Graph
10989 Commits
Author SHA1 Message Date
Damien Bouvy 18e06fa90a [IMP] web: kanban content container
The 'new' (read: the classes not in the 'compatibility layer section')
classes of the kanban views did not allow to cleanly separate an image
header from a content container.

This commit adds such a container, allowing a very simple layout that
should work all the time for a typical 'card with left image and right
content layout':
```xml
<div class="o_kanban_record oe_kanban_global_click o_kanban_record_has_image_fill">
  <field class="o_kanban_image_fill_left" name="image_128"
         widget="image"
         options="{'zoom': true, 'background': true, 'preventClicks': false}"/>
  <div class="o_kanban_record_details">
    <div class="o_kanban_record_top">
      <div class="o_kanban_record_headings">
        <strong class="o_kanban_record_title">
          <field name="x_name"/>
        </strong>
      </div>
    </div>
    <div class="o_kanban_record_body">
      <!-- some fields here (e.g. tags,...) -->
    </div>
    <div class="o_kanban_record_bottom">
      <div class="oe_kanban_bottom_left">
        <!-- some fields here (e.g. kanban status,...) -->
      </div>
      <div class="oe_kanban_bottom_right">
        <!-- some fields here (e.g. user image,...)-->
      </div>
    </div>
  </div>
</div>
```

Before this commit, the absence of a container for the right side meant
that the top/body/bottom were flex-growed in a flex-direction: row
element, appearing as 3 columns instead of rows.
2020-02-04 10:46:40 +00:00
Damien Bouvy ea4c934728 [IMP] web: allow background-style images for custom models
The `FieldBinaryImage` assumes that the image mixin is used to manage
its fields - this is mostly true, until you use custom fields.

This commit makes using the 'background' option of the Image widget
possible by fallbacking the thumbnail field's name to the name of
the field itself instead of `image_128` when we're dealing with a custom
field.
2020-02-04 10:46:40 +00:00
Denis Ledoux 355cb45603 [IMP] base_automation, web: give possibility to disable/edit failing automated actions
If an automated action raises an exception, in the traceback modal:
 - For admins, display Disable & Edit automated action buttons
   to be able to directly know with wihch automated action the error occurred,
   and to give the possibility to edit or disable it quickly,
 - For regular users, just add a paragraph to tell with which automated action the error occurred,
   so they can give this useful information to their administrator

This is specially useful for databases which have just been
upgraded to a newer version, and for which the server action
is failing because its code is no longer supported.

closes odoo/odoo#44513

X-original-commit: 8f3940c132bbbc99e47fa3f0cba0e768159d9af2
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2020-02-03 16:16:01 +00:00
Mathieu Duckerts-AntoineandJason Van Malder 95f40530f3 [FIX] web: fix date filters
Issue

    If month - 1 or month - 2 are in the previous year, the filter is
    incorrect.

    ex: Date = Jan. 2020, Filter = Dec. 2019
        => last_year__last_month = 2018-12 instead 2019-12

Cause

    If date is 2020-01-20

    Selecting December => adding param "last_month"
    Selecting 2019 => adding param "last_year"

    Applying "last_month" => date become 2019-12-01
    Applying "last_year" => date become 2018-12-01

Solution

    Detect the right year to activate by default
    when a month is selected and no year is selected.
    With that solution it is not possible to get records in Jan. 2020
    or in Dec. 2019 only for instance but the global functioning
    of date filters stays the same as before.

OPW-2169528

closes odoo/odoo#44208

X-original-commit: 096fdc7d3fe0799aa761c6ad3597569a002c698e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Jason Van Malder <jvm@odoo.com>
2020-02-03 13:57:17 +00:00
Yannick Tivisse 634dd65471 [IMP] web: Reload after company creation
Purpose
=======

At the second res.company creation, the multicompany mode is 'enabled'.
But to get the company selector dropdown, the user needs to reload the page.

Specification
=============

Force a reload at res.company creation, similarly to the forced reload when updating the language (lang) of the user.

closes odoo/odoo#44386

Taskid: 2127257
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-03 13:38:06 +00:00
Krunal Trivedi 86c95be9a0 [FIX] web: fix product, rating, channel etc. kanban view
Due to commit https://github.com/odoo/odoo/commit/7ecae3357117b1fd9889540556d5eba14ef8f237
which is introduces Next Activity icon on kanban cards at left bottom
of the card in contacts

however, this change effects other kanban cards making image and
details separated, such effected kanban views are ratings in project,
products and channels in live chat so fix the layout issue for all the
above kanban cards and it will not effect the contact kanban view.

taskID-2183676

closes odoo/odoo#44349

Closes: #44349
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-31 12:16:58 +00:00
Michael Mattiello (mcm) 3fd7b2009e [ADD] web: add owl AbstractField
This commit adds the new AbstractField class written in owl,
meant to be extended by specific Field owl implementations.

Note that its API is not complete yet, but it is enough for
basic usecases.

This commit also adapts the BasicRenderer to instantiate the
future new fields that will be written in owl.

closes odoo/odoo#43759

Related: odoo/enterprise#7872
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-03 11:08:04 +00:00
Lucas Perais (lpe) 6bdcf054fd [IMP] web: custom_hooks: dynamic inheritable event handling
This commit's intention is to bring class inheritance of event handlers
to components.
Use case:
A component class may want to set generic event handlers for all classes
inheriting from it, in order to set shared event behavior from the start
It is the case in many parts of Odoo, in particular in the cases of fields
which need at least to react on some keyboard event for navigation

The way to implement such a behavior is to make use of the
`useListener` OWL hook, by passing as arguments
event name and the handler function
2020-02-03 09:15:02 +00:00
Aaron Bohy a3e24efc19 [REF] web: remove custom useExternalListener hook
This hook is now available in owl directly, so we remove its custom
definition in Odoo, and adapt the code using it.
2020-02-03 09:15:02 +00:00
Aaron Bohy 6eadb1f7f6 [FIX] web: update owl to last version
This commit updates owl from v1.0.0-beta5 to v1.0.4.
2020-02-03 09:15:02 +00:00
Aaron Bohy 8641c46ccb [FIX] web: do not deploy services twice
Since 671a5471cd, services are deployed twice in the backend:
once by the webclient (as it is a ServiceProvider), and once by the
env (which now deploys the services to make them directly available
for each Owl component of the component tree). As a consequence,
some services perform twice some operations (e.g. the mail service
fetches twice the /mail/init_messaging route, the crash manager
service displays twice the tracebacks...).

This commit fixes the issue by making the webclient directly use
services from the env, instead of deploying them a second time.

Part of 2183810

closes odoo/odoo#44301

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-01-31 10:35:37 +00:00
Alexandre Kühn 7a691c8eb0 [FIX] web: update search view menu on click IME suggestion menu
Before this commit, when typing something in the search view in
Japanese, and then clicking on a suggestion from the IME dropdown
menu, the search view menu did not update with selection.

Steps to reproduce:

- Enable Japanese IME in hiragana mode;
- Type "test" in search view;
- Soft-select another suggestion item, e.g. "テスト";
- Double-click on suggestion item "test";

=> The search view menu still detects "テスト".

As a result, clicking on any of these search view suggested filters
picks "テスト" instead of "test".

This commit fixes the issue by updating search menu when clicking
in a suggestion in the IME menu.

opw-2061590

closes odoo/odoo#44318

X-original-commit: 0bca4c0883f2b58842da6a8c1a4e26bf2444d5f3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-01-30 14:11:06 +00:00
Dhruv Patel d5d2c5524c [FIX] base,web: url widget: add protocol in href
With this commit, the url widget automatically prefixes the href
url by http:// if no protocol is specified, so that clicking on
the url will by default redirect to an external website.

To prevent this behavior, one can still specify the new option
'website_path: true' on the url field node in the view arch.

Thanks to this, we can remove a similar logic (only implemented on
res_partner model) which automatically altered the value saved in
database to force its 'http://' prefix.

task-2153184

closes odoo/odoo#42118

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-30 14:03:36 +00:00
Aaron Bohy 23490fc22f [IMP] web: web_ribbon: handle longer labels
This commit implements a simple heuristic to display longer texts
inside the web_ribbon widget: we adapt the font size according to
the text length, and we tolerate to display it on several lines.

This commit also allows to specify a tooltip in the xml (with
tooltip attribute).

Task 2185023

closes odoo/odoo#44279

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-01-30 12:57:35 +00:00
Lucas Perais (lpe) b0500b6858 [FIX] web: file upload progress bar should not conflict with the field ProgressBar
closes odoo/odoo#44255

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-01-30 12:22:26 +00:00
Xavier Morel c4e075cf04 [IMP] core, web: test failure reporting
* remove misleading documentation about a "test failed" message, in
  13.0 any uncaught exception or console.error will cause the current
  test to be interpreted as failed
* fix tour manager to console.error its step and not add a second
  useless error message
* fix menu tester to try and display the failure cause on failure
* improve qunit's test reporter to print the number of tests failed in
  case of test suite failure

Should make test failures in tours a bit clearer.

closes odoo/odoo#44296

X-original-commit: 78121b68d099b16f2d775a7a8a963a2a0f474843
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-01-30 12:33:05 +00:00
Aaron Bohy b5d6080366 [IMP] web: sidebar actions: send 'select_all' info
In a list view, select some records (either by selecting them one
by one, or by clicking on the header to select all records), then
click on an action (except for the special case of 'Export') in the
sidebar. Some information about the selection is put into the
context:
 - active_ids: the ids of the selected records (only those of the
   current page)
 - active_domain: the current domain

However, before this commit, there were no way to determine whether
the user checked the header checkbox (i.e. all records), or some of
them individually.

This commit adds the information, with a 'select_all' key in the
context.

Note that this is a quick solution, as we need it right now for an
accounting usecase. A more elaborate solution, which will allow the
user to choose whether he wants to apply the action on the selected
ids or on the whole domain, will be developped soon.

Part of Task 2146469

closes odoo/odoo#44248

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-01-30 10:29:25 +00:00
Julien Mougenot e467d8fd9e [IMP] web: rounded avatar in kanban cards
closes odoo/odoo#43779

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-22 09:45:55 +00:00
Ankita Raval 0052222b54 [REF] web: calendar: allow disabling the delete button
In this commit, we add a new attribute "Delete" for user conveniency
if he don't want 'Delete' button on popover card they easily achive
by "delete=false" attribute and also add a testcase for it.

task-id:2088954
2020-01-29 09:57:23 +00:00
Julien Mougenot 5f6571a6fe [FIX] web,mail: only apply modal activity for Dialog modals
Before this commit, the CSS rule handling the "activity" of the modals
(their z-index compared to the one of their backdrop) was global and would
interfere with front-end or custom modals which do not use the static Dialog
methods giving them the "active" class.

Now, the rule has been inverted: the z-index of a modal is only changed when
it is given an "inactive" class, thus only impacting the modals instantiated
via Dialog or Owl Dialog classes.

closes odoo/odoo#44067

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 11:35:14 +00:00
jbm-odoo 64d0fe4118 [IMP] calendar: Avoid having no more filters
Before this commit:
In calendar view, when you unselect all filters of a category, all
events disappear (it's expected), but all filters also disappear.
So you can't selectd anything, you must reload the view to unlock
the situation.

After this commit:
When you unselect all filters of a category, all events disappear but
the filters stay as before selection (of course the last unselected
filter stay unselected).

closes odoo/odoo#44031

Taskid: 2146842
Related: odoo/enterprise#7970
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-28 10:25:11 +00:00
jbm-odoo ffe324877d [IMP] timesheet: Improve timesheet report
Some small improvements in timesheet report view.
In measures of graph, take string attribute into account.

closes odoo/odoo#41348

Taskid: 2149371
Related: odoo/enterprise#7041
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-28 10:28:33 +00:00
Debauche Stéphane 75f7ab0608 [FIX] web: fix email and phone widgets with empty value
When the value is empty in a related field, string of the element was
displaying "false" instead of an empty string which is not what we expect.
This commit fixes that issue.

Task ID 2119333
PR #40949
2020-01-28 09:14:43 +00:00
Mohammed Shekha e5aa3109f5 [IMP] web: show measure row in xlsx file
before this commit: if only one measure is enabled then measure row not
displayed in downloaded xlsx file

after this commit: downloaded xlsx file will always have measure row
either single measure enabled or multiple measure enabled

task-2127388

closes odoo/odoo#40769

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 09:00:35 +00:00
Mohammed Shekha c40c11761d [IMP] web: change pivot download file from xls to xlsx
before this commit: file was downloaded in xls format, which supports
maximum 256 columns and 65536 rows.

after this commit: pivot returns xlsx file when table printed and
downloaded, we have support of xlsxwriter, xlsx file supports 16384
columns and 1048576 rows

task-2127388
2020-01-28 09:00:29 +00:00
mcm-odoo 5aa0822a9d [REF] mail: migrate activity renderer to owl
In order to prepare the future, we want to convert everything in Owl.
This commit converts the activity renderer.

closes odoo/odoo#42278

Task: 2149408
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 07:42:56 +00:00
jbm-odoo 00b2046460 [IMP] calendar: Adapt views and test for new color and filters
closes odoo/odoo#41573

Taskid: 2153249
Related: odoo/enterprise#7157
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-27 16:08:34 +00:00
jbm-odoo fa48e05f42 [IMP] calendar: Improve color and filters
Now in a calendar view, if we use the color, attribute, it will use
the same color as Gantt views and the color picker widget.

The attribute color isn't more set as default in filter because it make,
in most situation, no sense to filter by color.

Now, we can add new filters in the right panel. To do that, we must
add the attribute "filter='1'" in the corresponding field line.
And if the filter has no direct link with the color of the model,
we can specify an attribute 'color' for this filter line block.
(for example color='color', and the color of the related model
will be used)

TaskID: 2153249
2020-01-27 16:08:34 +00:00
Lucas Perais (lpe) d41d627569 [IMP] web: field phone widget deals with SMS by default
Task 2123526

Before this task, the phone widget on char fields was not
displaying the send sms button by default

After this task, the default behavior of the phone
widget is to display the send sms button
2020-01-27 09:31:52 +00:00
Hardik Prajapati 87397d0080 [IMP] web: fixed column widths in datepicker
task - 2166438

closes odoo/odoo#42999

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-27 11:39:01 +00:00
Aaron Bohy f2de55322e [FIX] web: ComponentAdapter: do not override render
In Owl, 'render' is a (async) function of Component. It should not
be overriden in Component specifications, especially to do
something else (in this case, rendering the sub widget), without
calling super.

closes odoo/odoo#43980

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-01-27 08:58:36 +00:00
Mohammed ShekhaandAaron Bohy 23878ee11a [IMP] web: always display statusbar widget
By default, in readonly, unset field widgets (and their labels) are
not displayed. However, we would like the statusbar widget to be
always displayed (even when it is not set).

This commit introduces a new method 'isEmpty' on AbstractField, and
uses it (instead of isSet) to determine whether or not a field should
be hidden. By default, it uses isSet, so that it doesn't change
anything for the other fields, and we override it in statusbar to
always return false.

There was a need to make the distinction with isSet, as this one is
used to determine if a record can be saved (if the field is required,
and isSet returns false, it can't be).

task-2172272

closes odoo/odoo#43419

Related: odoo/enterprise#7929
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-01-27 09:01:19 +00:00
Jeremy Kersten 9f1fa0852d [FIX] web: backport fix from ace.js
Bug in ace-editor is present since that we updated in 1.3.1.
Because diff between 1.3.2 and 1.3.1 is big (-1288 +4661) with new feature...
We prefer just patch the library in stable branch applying part of commit:
https://github.com/ajaxorg/ace/commit/1890598a5da2259cfb0ceac38fed7bca582765db

To do in master? : upgrade ace.js

How to reproduce:
   > create ir.ui.view
   > be sure to empty all the content
   > type '<xpath expr=""'
   > Now if you type the > it will crash
        - Cannot read property 'type' of null

closes odoo/odoo#43955

X-original-commit: 1a90740b8e699fc3afa28c3ddb5490328facb995
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-01-24 17:56:06 +00:00
Hardik Prajapati dd5f793bea [IMP] web: Set a max width on company switcher menu
Purpose:
There is no max width on the company name of the 'switch company menu'
of the systray (o_switch_company_menu).
On smaller screens, and when in debug mode, it quickly either
linebreaks the systray of crops the menu items.
So set the max width and text ellipsis on menu.

task-1985500

closes odoo/odoo#43847

Closes: #43847
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-24 11:45:42 +00:00
Priyanka KakadiyaandMohammed Shekha 8e48ba3eb5 [IMP] web: show start time of regular event in calendar
With this commit, the start time of single day events is displayed
in the calendar view, in month mode. This only applies to non allday
events. This can be disabled by setting (already existing) option
'hide_time' to true on the calendar arch.

task-2058477

Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-01-24 12:38:47 +00:00
Mohammed Shekha 9dfb1262a5 [IMP] web: do not set text-muted on boolean_toggle click
currently if boolean_toggle widget is inside listview and if it is clicked and
set to false then listview row text set to text-muted, we want to remove this
behaviour as it is inconsistent and breaks any decoration-xxx set on the
treeview.

task-2179066

closes odoo/odoo#43754

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-22 12:35:04 +00:00
Xavier Morel f9c8a7e7d8 [FIX] web: client-side RPC error to have an arguments data member
Several XHR error handlers expect a data.arguments member which holds
the args tuple from the Python exception.

Some have alternate codepaths for "xhr errors" but several
don't (e.g. addons/payment/static/src/js/payment_form.js:142,
addons/web/static/src/js/services/crash_manager.js:229,
addons/website/static/src/js/content/website_root.js:167) and will
thus blow up on synthetic client-side xhr errors.

Modify the synthetic errors so they provide that member as an array.
2020-01-21 06:56:14 +00:00
Xavier Morel 0198c3e05d [IMP] core: reporting of browser logs / errors during setup
Sink handling of JS logging, exceptions and websocket timeouts so
calls other than _wait_code_ok handle them somewhat properly: the
issue fixed by odoo/odoo#41231 passed because it occurred during
module loading, which happens during initial page loading (browser_js
> navigate_to > _websocket_wait_event), which ignored logs (and
exceptions though here it's a console.error log), and as a result
reported no failure (and would simply miss that specific test as well
as every test following it).

Also since ChromeBrowser treats console.error as an exception,
important messages should be logged atomically. Merge two consecutive
console.error into a single one at the loading of modules so we don't
just get an exception "error while loading foo.bar" without any of the
useful details.

That ChromeBrowser treats console.error as exception is also why the
new method gets a flag (to suppress this behaviour): in the case of
two console.error, upon encountering the first it's treated as an
error so we try to take a screenshot, which goes through the messages
in order to get the screenshot response, which encounters the second
console.error, which gets treated as an exception, which hides the
first error.

Instead, screenshotting (and more generally _websocket_wait_id) should
treat console.error as a regular logging call, probably.

Also run JS tests in debug=assets for easier debugging (ha!) and
improve formatting of exception object when receiving an exception:
* if we can get a description on an `exception` remote object just
  print that, it's formatted to show the exception type, message &
  traceback
* otherwise format the garbage that is an "ExceptionDetails" object
2020-01-21 06:55:32 +00:00
Jason Van Malder e6fa563222 [FIX] web: fix studio child view datapoint content
Issue

    - Install Employees & Studio
    - Configuration > Check Skills Management
    - Go on an employee form
    - Remove all data in Experience, Education & Skills
    - Open Studio
    - Click in the blank space before Skills
    - Edit Form View

    Traceback

Cause

    The ORM tries to get the parent fields because the generated
    datapoint includes them. (45bc7c9)

    Normally the parent model is the same than the child model
    but not in studio.

Solution

    Merging the fields in the datapoint only if the models are the same.

OPW-2125214

closes odoo/odoo#43695

X-original-commit: d2dbc4faaad0988d71f591be7f50c94d455541b0
Related: odoo/enterprise#7849
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-01-21 18:14:23 +00:00
Arnaud Baes 13c1f4fa34 [FIX] website_crm_partner_assign: Partners images size.
Small fix on the template to ensure the size of the partners's
images will never be larger than 128px.

closes odoo/odoo#43875

X-original-commit: 4879ace6868e02703069bcf420bd77275ee381f7
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-01-23 18:23:12 +00:00
shreya thakrar 289f47da14 [FIX] web: remove min-height of form sheet within a modal
We added min-height for `o_form_sheet` in form view with a commit[1] restoring
the views design (after views refactoring).

However, the min-height isn't very useful when form view is opened witin a
modal (FormViewDialog). Especially, when the form view is having only few
fields, the `o_form_sheet` container occupies unnecessary height and looks
a bit ugly.

This commit fixes the issues by setting the min-height to `0` for
`o_form_sheet` container in such cases.

[1] - https://github.com/odoo/odoo/commit/250e716c3a12#diff-01e46b3171a7282967199e5d45fca0e6R15

TaskID: 2150471
PR #41619

closes odoo/odoo#43865

X-original-commit: 144d720bdc54ce762b84b1a78aa7e517ec1c3dd2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-23 16:09:50 +00:00
Pierre Paridans 43db60dffa [FIX] web: notebook tab headers container
This commit adds a wrapper element around the form view's notebook
tabs headers to allow the use of `overflow` and make it scrollable (e.g.
on smaller screens) without breaking the tabs' styling (e.g. the bottom
border).

This commit fixes an issue introduced by odoo/enterprise@e07aafbe6f.

closes odoo/odoo#43843

X-original-commit: 967777793cf2a7591ef3d9325497b105eb86577c
Related: odoo/enterprise#7906
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-01-23 12:42:04 +00:00
Aaron Bohy b980086d27 [FIX] web: MockServer: search_read: handle sort on many2one
Before this commit, if the records had to be sorted according a
many2one field, and there was a sequence field on the many2one
comodel, the sequence was ignored. Now, the sequence is taken into
account like the actual server does.

Linked to odoo/enterprise/pull/7407

closes odoo/odoo#43763

X-original-commit: 714e52f98eec5c64a224523cee4b1e14463ed191
Related: odoo/enterprise#7869
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-22 13:29:16 +00:00
jerome hanke (jhk) 513aab315c [FIX] web: typo in _mockSearchRead
https://github.com/odoo/enterprise/pull/7407#discussion_r362451701

opw-2128922

X-original-commit: cdfa00ecfdc988cb29b0d1f901db466b890940b1
2020-01-22 13:29:16 +00:00
370f53d8dc [IMP] web: conditional create/delete options on x2many fields
After this commit, x2many fields can have options like
create/delete which accept a domain, to make create/delete on
x2many conditional, say for example x2many field can have options
like:

options="{'create:' [('foo', '=', True)]', 'delete:' [('foo', '=', True)]'}"

With this when foo field is True, Create and Delete actions will
be available, but if foo is False then they won't.

In case of one2many fields, if 'create' is false, then 'Add a line'
(list) or 'Add' button (kanban) won't be displayed.

In case of many2many fields, 'Add a line' or 'Add' button will
always be displayed even if 'create' condition is false as it
doesn't really create records (but rather links existing ones).
Same applies for delete.

Task-2092953

closes odoo/odoo#42919

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Parth Chokshi <pch@odoo.com>
Co-authored-by: Aaron Bohy<aab@odoo.com>
2020-01-22 13:01:33 +00:00
Romain Derie 98678199a3 [FIX] *: fix translations inconsistency in 't-set'
This commit fix most `t-set` errors that either led to:
  1. unwanted text to be considered as translatable.
     eg: `<t t-set="classes">text-left bg-100 p4</t>` would create an
     `ir.translation`.
  2. text that should be translatable were not.
     eg: `<t t-set="text" t-value="'Both'"/>` would not create an
     `ir.translation` while it should.

If a text should be translatable, it should never be inside a `t-value`:
  - `<t t-set="text">Both</t>`
If a text should not be translatable, it sould either be inside `t-value`,
`t-valuef` or the `<t>` tag should have `t-translation="off"`:
  - `<t t-set="classes" t-translation="off">text-left bg-100 p4</t>`
  - `<t t-set="classes" t-valuef="text-left bg-100 p4"/>`
  - `<t t-set="classes" t-value="'text-left bg-100 p4'"/>`

https://github.com/odoo/odoo/pull/43660
https://github.com/odoo/enterprise/pull/7839
https://github.com/odoo/design-themes/pull/203

closes odoo/odoo#43660

Related: odoo/enterprise#7839
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2020-01-21 15:32:08 +00:00
Aaron Bohy 7ab364b627 [IMP] web: properly throw errors in MockServer
Otherwise, they could be catched (by a guardedCatch) and thus would
not make the test fail.
2020-01-21 11:59:22 +00:00
Aaron Bohy 50bf8309f8 [FIX] web,*: fix race condition with m2o quick create
*sale,sale_product_configurator

Let's assume a form view containing a many2one with an onchange
that updates the value of a one2many. Do a quick create in the
many2one. While the name_create request is pending, add a row to
the one2many but do not leave it. When the name_create returns, and
the onchange has been performed, the one2many is reset, and the row
is no longer in edition (worse, it could be invalid, i.e. in a state
that the user could not have reached in a normal situation).

This commit fixes this issue by considering the whole [name_create +
onchange] operation as one. This operation is executed in the mutex
of the model, so the other request (adding a row to the one2many) is
delayed until the many2one value has been correctly set.

This fixes an issue with the sale and rental tours (on sale_order),
that had been deactivated for a while.
2020-01-21 11:59:22 +00:00
mcm-odoo 01e3a5996f [REF] web: pivot: use owl_compatibility tools
This commit changes ControllerAdapter to a mixin that inherits
WidgetAdapterMixin and RendererWrapper now extends ComponentWrapper.

This commit also changes PivotController base class/mixin and uses
the Odoo legacy custom_events because of the adapter.

closes odoo/odoo#43256

Related: odoo/enterprise#7744
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-01-21 10:22:50 +00:00
mcm-odoo 083ba2a811 [IMP] web: WidgetAdapterMixin: add some tests 2020-01-21 10:22:50 +00:00