Commit Graph
11023 Commits
Author SHA1 Message Date
Lucas Lefèvre b7d1db596b [FIX] web: Call on_attach_callback on systray widgets
Currently, the method `on_attach_callback` is never called on any Widget in the
systray.

Calling `on_attach_callback` is required if any systray widget uses an OWL
component via the ComponentWrapper. Without the callback, the component is never
considered mounted to the DOM and no event handler is triggered.

closes odoo/odoo#46566

Related: odoo/enterprise#8887
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-03 11:01:03 +00:00
Lucas Perais (lpe) 9ce6136be7 [FIX] web, base: make company-specific report assets static
Before this commit, the company specific colors and font were
implemented by systematically overwriting a "virtual" report SCSS
asset file before rendering each report.
This caused many issues, forced frequent asset bundles recomputations
(performance problem + cache invalidation causing random bugs).
And it could simply not work in a multi-company setup where multiple
styles are involved, as the asset management could be made not
thread-safe.

PR #44225 was a first attempt to mitigate the numerous problems by
making the asset bundle invalidation less frequent. But the problems
were still present and a more complete solution was necessary for
multi-company setups.

Besides, the design of the bundle forbade making company specific assets.

This commit uses a different approach: instead of having a
company-specific asset that needs to be constantly updated, a global
"multi-company" asset is maintained and included in the report assets.
It only needs to be generated when a company style changes, not for
every rendering operation.

Unfortunately this change cannot be fully performed without updating the
template declarations, so it will require an update of the `web` (or
`base`) module to be operational.

As this represents a rather invasive change in a stable branch, extensive
testing was conducted to minimize the effects and ensure proper
degradation of features for production deployments where the new code
would be deployed without forcing an update of the `web` module:
- The report SCSS files were left untouched, to prevent any bundle
  invalidation, ensuring that old cached assets would remain valid. This
  means that single-company setups should not see any visible difference
  after pulling the code (with or without updating `web`).
  SCSS cleanup will be done later.
- Existing Python methods were kept but emptied, to make sure that
  old templates and code would not crash.
- For multi-companies, the last used colors will be applied for all
  reports until the `web` module is updated. The old behavior was not
  working correctly anyways, so the degradation is actually limited.
- For all setups, changing the colors after deploying this patch will
  have no effect unless the `web` module is updated.

/UPDATED FOR master on top of #44393/:
- removed the `res_company.update_scss()` method entirely
- fixed the report SCSS styles, as the variable names referred to the old
  behavior, e.g. "$o-company-primary-color" is nonsense.
  Renamed to "$o-default-report-primary-color" etc.

--
Improves #44225
Forward of #44393

opw-2168623
opw-2171040

closes odoo/odoo#46647

X-original-commit: a5b1421aecf27b1de408434d3bb6d7ac81f57dc3
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-03-02 13:22:09 +00:00
jvm-odooandaab-odoo b8b0a2ac7f [FIX] web: fix more menu
Issue

	- Install Accounting
	- Resize your window to have the more menu
	- Refresh the page to make the JS working correctly
	- Click on the item on the left of the more menu
	- Do not close the menu just hover the more menu
	=> It doesn't appears (the .show class is on the last <li> child instead of the parent)
	Click on the more menu
	=> It appears but small & with items broken

Cause

	Without the :first, all the more menu dropdown where toggled

Issue

	Add :first to the target to toggle

OPW-2178843

closes odoo/odoo#46553

X-original-commit: 55a4a834461446a070ad06d1b24d67fbc27799a1
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Co-authored-by: aab-odoo <aab@odoo.com>
2020-02-28 12:22:43 +00:00
qsm-odoo 4d37071213 [FIX] web: review domain for assets attachement
Make the domain to match assets attachment more robust to avoid
deleting wrong files.

closes odoo/odoo#46523

X-original-commit: c92d63fa5baf09cb0969fcf4fbd5c28407af58ae
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-28 09:52:26 +00:00
Odoo's Mergebot 35e66df3e2 [IMP] * : generic improvements
[IMP] sale_timesheet: add domain on sales order field
==========================================

A domain has been added to the Sales Order field
on project task so that the task and the so have the same
commercial_partner_id.

[IMP] sale: add kanban view for sale.order.line for better display on mobile
=========================================================

For a SO line on mobile it was displaying only the name of the line without
the SO number. It wasn't very practical for the users so we added this view
to display the display_name instead.

[IMP] web: change the default name of a column in kanban view
=================================================

This changes the name of the column in kanban view when the records
are grouped by date. The column name of the records with no date
went from false to Undefined.

Task-2188831

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#45646

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-28 11:24:49 +01:00
Prakash Prajapatiandjdoutreloux 901f5bbd82 [IMP] web: change the default name of a column in kanban view
This changes the name of the column in kanban view when the records
are grouped by date. The column name of the records with no date
went from false to Undefined.

Task-2188831

Co-authored-by: jdoutreloux <jud@odoo.com>
2020-02-28 10:15:32 +01:00
Nisha patel 4df7594d58 [FIX] web: fix boolean fields display in pivot view
Since formatBoolean returns a jQuery object, boolean fields were
displayed as [Object object] in pivot view.

so fix the issue of checkbox in the pivot view by not calling
fromatValue for boolean instead just set the checkbox element in
in template itself and added test case for checkbox in pivot view.

closes odoo/odoo#46445

Taskid: 2172258
Closes: #44299
X-original-commit: d7d0caf6f599f313687c958c5aff5764c0d23ffd
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-27 13:16:32 +00:00
Michael Mattiello (mcm) 202f7119ae [FIX] web: fix ComponentAdapter after owl update
The signature of method Component.__patch has changed in the last
version of owl.

closes odoo/odoo#46499

X-original-commit: 2954aa3ecd235d5ed6f537be21882390e8fcb808
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-28 07:53:21 +00:00
Michael Mattiello (mcm) 74d3fc4d87 [FIX] web: update owl to last version
This commit updates owl from v1.0.4 to v1.0.5.

This last version fixes an issue in the home menu (enterprise).
Issue's task: 2196878

X-original-commit: cce932b9179c5acb6845b895b04312c937f8de96
2020-02-28 07:53:21 +00:00
Mathieu Duckerts-Antoine 743d551331 [FIX] web: Regroup and order date groupby options
A previous commit makes the graph view render only the finer interval
option for each date/datetime field.
The fact is that in the control panel, different options can be selected
in any order along with other groupbys. This can lead to situations like

'Foo > Date: Day > Bar > Date: Month'

and becomes unreadable.
For that reason we choose to regroup and order options. For the previous
situation, this leads to the following global groupby

'Foo > Date: Month > Date: Day > Bar'.

Our choice also make more sense in a list view for instance.

Task ID: 2198846

closes odoo/odoo#46269

X-original-commit: 59afc869233165e21ef94f485b91d33ac4543b24
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-25 15:30:06 +00:00
Mathieu Duckerts-Antoine c7851add36 [FIX] web: graph renders only finer date groupby option
Rendering a graph view with several options selected for a given
date groupby can take too much time and block the page.
Since grouping on the same date/datetime field several times
barely makes sense in a graph view, we choose to use only the finer
option, e.g. 'week' is prefered to 'quarter'.

Task ID: 2198846

X-original-commit: 7e36bee14e18ca17e15de1bacb7ff26010d0b372
2020-02-25 15:30:04 +00:00
aab-odoo a39cc6bc00 [FIX] web: grouped list with pager: reset offset on search
Have a grouped list view with enough groups to have several pages.
Go to the second page, and toggle a filter s.t. it only remains a
single page of groups.

Before this commit, no group is displayed (like if there was no
record matching the domain), whereas it should display groups of
page 1. The issue occurs because we didn't reset the group offset
to 0, like we do for the regular offset.

Bug reported in the v13 migration pad.

closes odoo/odoo#46257

X-original-commit: c6a4123b25e884495c5c44287d4d9fed061eeaa4
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-25 14:15:32 +00:00
Lucas Perais (lpe) 9256492f10 [FIX] qweb2: ignore comments between branching directives
Have a template of that form:
```xml
<t t-if=""/>
<!-- Comment -->
<t t-elif=""/>
```

Before this commit, both python and JS crashed because any type of node
between branching directive was forbidden

After this commit, Comments are just ignored and removed, while actual
template nodes are still forbidden between branching directives
There is no crash anymore

closes odoo/odoo#45899

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-02-24 15:32:19 +00:00
Nicolas Lempereur 78545ce0ed [FIX] web: digits option for aggregate is taken into account
If you have a currency with 3 decimals, when you show a list view
grouped, you might have result like:

[group partner 1 : amount : 4.4€]
-                  amount : 1.11€
-                  amount : 3.33€

which is a little odd, it is not that odd since the groupings are an
approximation (eg. you could have a line in EUR and a line in USD and
the grouping value would be the sum of both line).

But there is no way to specify another precision, and since this is a
grouping it could be of line of different currencies so we can't use the
lines currency to decide.

With this changeset, having for example:

<field name="amount" digits="[69,3]"/>

with `digits` attribute is taken into account for the aggregate value
and it would be displayed with 3 decimals.

Without the fix, the added test fails with:

    aggregates monetary use digits attribute if available
    Expected: "2000.000", Result: "2000.00"

opw-2195042
closes #45545

closes odoo/odoo#46094

X-original-commit: 4dd293c71851d0c6e9ffe09402cf54cfe889f402
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-24 12:46:46 +00:00
Krunal Trivedi eb1207a705 [IMP] project: Allow to use kanban example stages in particular project
Purpose of the task is allow to use a example stages in real project.

Added a button 'Use this for my project' in modal dialog of project
stages examples, by clicking the button, user can directly use stages
of an example in his project. if some stages already exists in project
then new stages will be added next to existing stages.

NB: The stage will be created in user's language. user have to manually add
transalation for en_US.

Taskid-2179536

closes odoo/odoo#44562

Closes: #44562
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-18 10:26:43 +00:00
Arnaud Baes 96eb99f0f2 [FIX] web : force o_image_128 max priority.
On the partners page, the class is not fully applied to the logos
because 'img-fluid' is applied first via the 'image' widget.

This cause max-width to be overriden with the value 100%, breaking
the partners pae layout.

closes odoo/odoo#45451

X-original-commit: 35bb2978d1af008ea8e84c664bc62f6fae0677db
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-02-16 13:18:36 +00:00
Romain Estievenart e0231481d6 [FIX] base,hr,web: kanban image sizing/look & feel
The image illustrating some kanban cards (like "Employees" or
"Contacts") has a weird scaling and rendering on smaller screen sizes.

Step to reproduce (on small screen):
1. Open Employee
2. Apply a filter
3. Picture is ugly (shape changes to get something pretty weird)

This commit fixes it by:
1. removing the rounding which was only applied (sic) on smaller screens
2. adjusting the size and/or the margins of the image to keep its ratio
   and the alignment with the other kanban cards.

Task ID: 2198419

closes odoo/odoo#45956

X-original-commit: dd5db84464998b45d0524055f9c96bcad894c4c9
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-02-21 14:28:04 +00:00
Krupal Oza 3a02f08960 [IMP] crm, event(_sale), gamification: avoid long labels in embedded tree views
PURPOSE

In various views, the min width of some columns is too short for the label of
the field. This task aims at fixing this by increasing some minimal widths
and relabeling some fields.

SPECIFICATIONS

crm
  * in view_crm_lead2opportunity_partner_mass, view_crm_lead2opportunity_partner
    add date widget on create_date and remove the phone field in the inline
    treeview of opportunity_ids;

event
  * in view_event_form set width of boolean field 'done' to 70px and in
    view_event_mail_tree set string of field 'mail_sent' to 'Sent'
  * in view_event_form_inherit_ticket set string of fields seats_max to
    'Maximum', seats_reserved to 'Reserved', seats_unconfirmed to 'Unconfirmed'
    and set width '100px' in the inline treeview of event_ticket_ids;

gamification
  * in challenge_line_list_view and challenge_form_view set string of field
    'target_goal' to 'Target' in the tree view and inline treeview of line_ids

LINKS

Task ID 2166865
PR #43401

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-21 09:45:56 +00:00
Prakash Prajapati 8bda216460 [ADD] web: Add qunit test for company creation/updation
Currently when the company is created or updated the whole
web-client is reloaded

so write a qunit test case when a company is created or when
the data is written to the company for the web-client reload.

closes odoo/odoo#44714

Taskid: 2188789
Closes: #44714
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-14 10:28:11 +00:00
Adrien Dieudonne 62c9227fda [FIX] web: document layout configuration: style not scoped
Commit 9a482fc introduced change for the document layout preview:
all "td" tag included in clearfix were in display: flex;
Because of this some styles were broken in form views on mobile.

We could have only put this rule in the right scope but
we preferred to fix this correctly.

Steps to reproduce:
- Go to Settings
- General Settings
- Click on Configure Document Layout

Related to task-ID: 2184243

closes odoo/odoo#45830

X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-02-20 14:47:04 +00:00
Michael Mattiello (mcm) 16c41832a3 [IMP] web: owl_compatibility warn only if debug=assets
Before this commit ComponentAdapter warned on every update and render.
This can make a lot of noises when we use some adpaters.

After this commit ComponentAdapter will warn only in debug=assets mode.

closes odoo/odoo#45583

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-18 08:56:41 +00:00
Joseph Caburnay 2c383aae48 [IMP] web: custom_hooks: useListener able to pass options to addEventListener
addEventListener supports an `options` argument, which can
be useful to listen on events during the capture phase

This commit allows to pass these options to the hook useListener

closes odoo/odoo#45478

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-02-20 12:33:54 +00:00
Ankita Raval d675dbaa4c [IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
2020-02-19 09:09:20 +00:00
Yenthe666 1477774582 [IMP] web: fix typo in datepicker
Before this commit the sentence was a bit weird as a date is not on the future but in the future. This commit resolves this.

closes odoo/odoo#45548

X-original-commit: b335c33655a707f71fbc01929f5eea2e659e7215
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-17 16:53:30 +00:00
Xavier Dubuc d2e24f5444 [IMP] js: time.js inner functions call improvement
Some functions defined in this file use another function present in the
same file through "this" keyword even if it's not needed.
This cause problems when these function are required in another file
using object destructuring.

This commit fix this issue by calling the function only by its name.

closes odoo/odoo#45299

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-02-13 13:15:02 +00:00
Lucas Perais (lpe) 8fd69c44f2 [FIX] sms, web: phone widget with sms tested in right module
Before this commit, the behavior of the phone widget was tested in web
as if it was always altered with module SMS
Giving wrong test results when sms module was not installed

After this commit, the separation is clearer, and the phone widget's
behavior is tested according to the modules it is altered by

closes odoo/odoo#45271

X-original-commit: 2e337516468797dd898c79c9669b5a90c83b56a7
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-02-13 10:18:33 +00:00
jvm-odoo bf14a04010 [FIX] web: fix translation dialog should use only active languages
Issue

	- Install CRM and at least 3 languages
	- Deactivate one of them
	- Go to CRM > Configuration > Activity Type
	- Edit an activity type and try to edit translation

	Traceback (Cannot read property '1' of undefined)

Cause

	This is because all the translations are fetched
	but we don't look if the language they use is active.

	So at one moment, the relatedLanguage is undefined and
	we do relatedLanguage[1]

Solution

	Filter the translation, to keep only the ones with an
	active language.

OPW-2193969

closes odoo/odoo#45215

X-original-commit: 9d1259da1bfd60362ec93996f723a4e378434dc8
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-02-12 15:07:05 +00:00
jbm-odoo 9a4da8894f [FIX] web: Avoid open too fast zoom
Picture of employees are maximazed directly which is annoying when
you move the mouse in kanban view.

Add the ability to put a waiting time before opening the zoom in
option of the field in the view (default value is 0).

closes odoo/odoo#45229

Taskid: 2191289
X-original-commit: a264b17d8fe18464df439d896ecb7dea106caa5a
Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
2020-02-12 15:54:06 +00:00
Xavier Morel e95ccf0908 [FIX] *: domains should not have as many binary operator as there are terms
* modify client-side domain normalisation to error if the domain is
  invalid (not enough terms / segments for the number of operators)
* add better error reporting to attrs / modifiers parsing
* add a few layered error augmentation to provide clearer context
  e.g. "error: invalid domain <thing>" is helpful but "error while
  parsing modifiers for field foo: modifier invisible: invalid domain
  <thing>" is much more helpful
* rework _evalModifiers to deduplicate it in order to more easily
  implement this contextual augmentation
* test that improper domains are properly found improper
* fix a bunch of incorrect attrs domains
* also removed an apparently undefined (& unused) "options" argument
  to a _applyModifiers call

closes odoo/odoo#44642

Related: odoo/enterprise#8175
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-12 09:32:17 +00:00
Julien Castiaux 450263338c [FIX] web: attach the trad alert to the form
The translation alert dialog was attached to the entire view in case no
status bar was found. This resulted in the following layout on large
screens:

    chrome
    --------------------------------------
    | alert dialog | form view | chatter |
    |              |           |         |
    --------------------------------------

Whereas when a status bar was set on the form view, the rendering was as
follow:

    chrome
    --------------------------------------
    |        status bar        | chatter |
    |       alert dialog       |         |
    |        form view         |         |
    --------------------------------------

The fix make sure the alert dialog is always placed just above the form
view just like when there is a status bar.

closes odoo/odoo#44878

Task: 2075172
X-original-commit: dacdc30681510e9c2db23610c5be5285a72a8949
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2020-02-07 14:32:58 +00:00
Michael Mattiello (mcm) 8750efef27 [FIX] web: kanban quick record creation
When grouping records in kanban view, if a quick create widget was
already opened, clicking on the "+" to launch another quick creation
would crash.

Fixes https://github.com/odoo/odoo/issues/44680

closes odoo/odoo#44949

X-original-commit: b482df17058e6f2117b616e6b152a7f2c90dc121
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-10 10:29:44 +00:00
Michael Mattiello (mcm) c5e34d77f5 [IMP] web: show % symbol outside the input in percentage widget
Before this commit the % symbol was part of the input. We could write a
value with the % symbol to divide the value by 100 (50% = 0.5, 50 = 50)

This commit removes the % symbol from the input and adds it in a span
after the input so we do not need to write the % symbol anymore.

The value from the input will be saved as $value / 100 in database.

task-2065078

closes odoo/odoo#43995

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-06 11:55:13 +00:00
Lucas Perais (lpe) c98579d25a [IMP] web: many2many list editable as m2m_tags
Before this commit, there was a discrepancy between
many2many_tags widget and regular many2many list

That is, in tag mode, when someone had read access alone on the comodel
he could modify the members of the m2m relation on the current model
Which couldn't be done in m2m list

After this commit, it is possible in a m2m list to add
records to a relation, even if we don't have CRUD access on the comodel

Task 44074

closes odoo/odoo#40194

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-02-06 10:19:00 +00:00
qsm-odoo 6f4c60fe1b [FIX] website, *: lazy load widget assets of the correct website
*: web

Before this commit, when a widget declared assets to lazy load through
the assetLibs key, the asset was loaded through a context-less call to
the server through the base `rpc` function. This caused problems in
website: the website ID was not given to the called route and the loaded
assets were then stripped of their specific-website parts.

This commit solves the problem by allowing the `loadLibs` and
`loadAsset` functions to receive an extra argument: an extra `context`
to use for the actual call to the server. The method is now available
in the ajax service, so that website can add its custom context
automatically, the same way it does it for normal `_rpc` calls.

Part of https://github.com/odoo/odoo/pull/44596

closes odoo/odoo#44596

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 10:48:44 +00:00
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