Commit Graph
13428 Commits
Author SHA1 Message Date
dmonzonis 56835877d2 [IMP] web: Fold column quick create on load examples
Before this commit, after adding a column or loading examples in a
kanban from the quick create column, it stays open. After this commit,
it will stay open if adding a column through it, but it will fold if the
user has loaded a set of columns from an example.

Task ID 2047369
PR #48299
2020-04-30 09:09:23 +00:00
dmonzonis 59a0b92995 [IMP] utm: Add kanban examples for UTM campaigns
Inspired by what is done in the task kanban of the project module,
add examples of kanban stage setups for UTM campaigns, and allow users
to load them.

There have also been some minor changes to the campaigns view:

- The helper message when there are no UTM campaigns has been changed
  to a more descriptive message.
- All stages that existed by default (hardcoded in the data XML) have
  been removed except default New one. An user with a fresh database will
  have no stages in their kanban. The old hardcoded stages have been moved
  to the demo data instead, so they will still be added by default if the
  user installs demo data.
- The ghost columns that appear in the kanban when no stages exist have
  been renamed to match the old stages that were hardcoded.
- When the user opens the view to create a column, the 'See examples'
  link will appear below the 'Column title', just like in the project
  addon, and clicking it will open some examples specifically made for UTM
  campaigns. Clicking on the 'Use This For My Kanban' button will load the
  stages of the selected example.
- A min-height property has been given to the example modal view so that
  the view does not change size depending on the number of rows in the
  ghost columns.

Task ID: 2047369
PR #48299
2020-04-30 09:07:28 +00:00
dmonzonis 897724e5c7 [IMP] web: Allow customization of text in button to apply kanban example
Before this commit, the only module that allows for selecting and
applying kanban column examples is the project module, for its tasks
kanban, so the message in the button to apply the example is hardcoded
as "Use This For My Project".

After this commit, the text in this button can be customized to make
this more generic, so a different module could use a different message
like "Use This For My Campaigns". If no text is specified, a generic
"Use This For My Kanban" is used instead.

Usage

```
kanbanExamplesRegistry.add('utm_campaign', {
    applyExamplesText: _lt("Use This For My Campaigns"),
```

Task ID: 2047369
PR #48299
2020-04-30 09:06:26 +00:00
vho cb55b30293 [IMP] sales_team, web: add and improve color widget to improve UX on crm.tag
The color picker help the user to choose a color instead of picking it
by id.

The title and arial-label "no-color" default value are removed from the
picker_preview because they are not accurate. Instead name of currently set
color is used.

Task ID 2128166

closes odoo/odoo#47474

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-30 08:29:57 +00:00
Aaron Bohy 4b289bfd3f [FIX] web: list: fix confirmModal template
Replaces unnecessary (harmless in this case, but still), 't-raw'
by 't-esc'. Also replace a t-raw used in the SwitchCompanyMenu
(unnecessary and harmless as well).

closes odoo/odoo#50411

X-original-commit: 691c9d2d2868885124749482aa8954322a40f130
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-29 15:35:21 +00:00
Julien Mougenot 6fc3bee255 [FIX] web: search many2one fields with correct value
Before this commit, searching a many2one field in the search bar would create a
domain with a parsed version of the input string. However the parser of m2o fields
returns a number (ID) and would consistently return 'NaN'.

Now, raw values are taken as is when searching with many2one fields.

Task 2239254

closes odoo/odoo#50410

X-original-commit: bac74010daae868da474de9439bc7027d9206e38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-29 15:30:27 +00:00
Alexandre Kühn ea143795e9 [FIX] web: fix rating kanban card layout
Revision on 7ecae33571

Commit above introduced schedule activities on partner kanban view,
and also made slight CSS change in order to position next activity
nicely at the bottom of the card.

This change broke the layout in Rating kanban view with a groupby
filter. This happens because some CSS rules made use of a combination
of inline-block/float/margin-compensation to display image next
to kanban textual information.

This commit fixes all above issues by using flex.

Task-Id 2237638

closes odoo/odoo#50386

X-original-commit: e7e3d14f980b221158042097568061363f6f1468
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-04-29 12:40:03 +00:00
Hardik Prajapati c2d5a4beaf [FIX] web: pivot view nocontenthelp message
Since the commit https://github.com/odoo/odoo/commit/46cf65d68e9c13193dff4b563b9b0bbb2199dfc1
when help is not defined in action then nocontenthelp is displayed as
[object, object] due to the desciption passed from renderder of the
pivot view.

So in this commit while calling the NoContentHelper pass the
descitption as string instead of jquery element.
we can use the t-value in template but that string will create
issue for transalation so pass the desctiption from the pivot render.

closes odoo/odoo#50347

Taskid: 2240167
Closes: #49859
X-original-commit: c7cc672aba669175280d619ad39b14daefd7733f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-29 07:08:15 +00:00
Xavier Morel f08b5d22a4 [IMP] web: handling of escaping in literals
Handling of escapes (`\`) was performed during evaluation rather than
parsing, so strings in the AST stored the escaped form (rather than
the proper one), and _formatAST had to mess around in order to try and
get it back into a semblance of relevance (especially as the AST would
store the escaped string without delimiters).

Fix: perform the escapes handling (aka normalisation) during
tokenization where it belongs. This means the AST formatter can now
just JSON.stringify the data. Until and unless we decide to produce a
cpython-compliant
repr (https://github.com/python/cpython/blob/0169d3003be3d072751dd14a5c84748ab63a249f/Objects/unicodeobject.c#L12902-L13006)
which is unlikely.

closes odoo/odoo#50236

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-27 13:59:49 +00:00
Mathieu Duckerts-Antoine 7b402c5e59 [FIX] web: limit on search panel values
Before this commit, if a many2X field with a big comodel was added
in a search panel, the view using it would crash. For instance that
problem occured in the kanban view for hr.job, where res.users
appears as the comodel for the field user_id.

Now, we fix an arbitrary limit of 200 to the numbers of values to fetch
for each many2X fields in the search panel. This avoid the problem
mentionned above.
Furthermore, in case the limit is attained for a field used
as select="one", the values are displayed without being hierarchized.
Indeed the limit can leads to gaps in the knowledge of the hierarchy
and consequently to a bad representation of it.

Task ID: 2154668

closes odoo/odoo#50334

X-original-commit: 8d57153b34c04952a85f6642951cb2697016da84
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-28 14:57:58 +00:00
Lucas Perais (lpe)andJulien Mougenot 6def725c6e [FIX] web: Owl compatibility: remount on same node
Keep a reference to the 'mount' method arguments to ensure that components will
be mounted on the same node and in the same way they were originally mounted.

This fix is related to the following changes in the Owl framework:
https://github.com/odoo/owl/commit/b4ad14edc03d4fb2d7a4622c6c1f63f6df5b4541

Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-04-28 09:29:49 +00:00
Julien Mougenot 03415f08f4 [IMP] web: update Owl to v1.0.7 2020-04-28 07:24:23 +00:00
Martin Trigaux 104ae05e7f [FIX] web: do not translate technical content
Avoid messing up with style by translating it

closes odoo/odoo#50251

X-original-commit: 6151757a8357693e189ff1ab31ece5efdbac65d6
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-04-27 15:58:11 +00:00
Aaron Bohy 797403c0a9 [FIX] web: list: don't call mounted twice on fields
Before this commit, when a list contained owl field components,
the mounted hook was called twice on those components. This may
cause tricky issues like handlers being bound twice, and memory
leaks.

closes odoo/odoo#50127

X-original-commit: 206dd91e78f7896fc6b01020507657e61771787f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-24 09:17:57 +00:00
Nicolas Martinelli 62fbf6e467 [FIX] web: font support for Cyrillic in sign report
Forward-port of https://github.com/odoo/enterprise/pull/9996

closes odoo/odoo#50110

X-original-commit: d4bef0aaa5f208c6092df71f2312c0ff4b6c8396
Related: odoo/enterprise#10181
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-24 08:21:22 +00:00
Aaron Bohy a3a415b130 [FIX] web: tests: detect failed modules in small suites
Before this commit, we waited for 10 seconds before defining the
boot test (checking that all JS modules have been correctly
loaded). However, small test suites (like the mobile one) ended
before this test was defined. So we could end up with a green
branch with tests not being executed (e.g. if a testing module
had missing dependencies, and was part of a small suite).

This commit removes the boot tests and instead does the check
at the end of the suite, before logging that the suite passed.

closes odoo/odoo#50109

X-original-commit: 048557eef32df94715ab464614c9d9d34c4a2689
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-24 08:11:17 +00:00
Julien Mougenot 85eef1ec4d [FIX] web: properly define control panel layout
Before this commit, some elements in the control panel were not properly encapsulated
in layout-related parent elements and this caused some inconsistencies if some of
the control panel components were not displayed. For example: if the breadrumbs
were missing, the search bar went to the left side instead of the right.

Now, all components are in a grid-like structure (in desktop mode) and should not
overstep their given boundaries. The layout in mobile remains unchanged since the
top part behaves quite differently.

closes odoo/odoo#50057

X-original-commit: 533db5991a5bb871198485cd71a63f75a8c6becf
Related: odoo/enterprise#10148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-23 10:32:25 +00:00
Martin Trigaux 2d00263127 [I18N] *: export saas-13.3 translations
closes odoo/odoo#50031

X-original-commit: 15a7a9f9d71a0b9c46d7caf2f4fbf09a5a4c63fe
Related: odoo/enterprise#10140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-04-23 07:13:48 +00:00
Julien Mougenot dd96271208 [FIX] web: handle empty notebooks in form views
Before this commit, when re-activating a previously active notebook tab, the form
renderer would assume that a tab was actually active. However this does not happen
if no tab is visible or defined and it results in a crash instead.

Now, if no active tab is found, a default active tab (0 = first) is set. This only
helps to prevent the crash and does not affect the current behaviour.

closes odoo/odoo#50006

X-original-commit: 73e0c0a1395ebd0e2b4ac7f857c863a0358c5e17
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-22 15:11:02 +00:00
qsm-odoo 9340f7460e [IMP] website, web: add "h" accesskey for home menu in community
Following the work on accesskeys on the website side with [1], there is
in fact no reason to have this in enterprise and not in community.

[1]: https://github.com/odoo/odoo/commit/0b0690a3934cedcab0d5e34373e8d40c2ab25660

closes odoo/odoo#49717

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-22 12:48:31 +00:00
Aaron Bohy ae4c9d1eca [FIX] web: toggle optional column in list with owl component
Have a list view with an Owl field component (e.g. widget="badge"),
visible. Open the optional field dropdown and make another field
visible.

Before this commit, the '_onToggleOptionalColumn' handler was
executed twice, because two click events where triggered: one on
the label, and one on its associated input (because of the for
attribute, see [1]).

As a consequence, the new field was added, and directly removed
from the view. This could even cause subsequent crashes.

The difference between an Owl component and a legacy widget is
that the Owl component is async (more than a nextTick) as we wait
for the nextAnimationFrame to render. When the rendering is fast
enough (e.g. without Owl components), the click event isn't remap
to the input yet (because we empty the list HTML node), so the
handler is executed only once.

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label

Issue reported on task 2204306

closes odoo/odoo#49920

X-original-commit: b02d347e8770835ad28a6487071930a904bce101
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-22 07:50:00 +00:00
Christophe Monniez cc871698fa [FIX] web: improve click_everywhere timeout message
When an element is clicked during the test and a tiemout occurs, message
that appears in Odoo logs is not really clear.

closes odoo/odoo#49907

X-original-commit: 0e1545c52fdca6d311a18533d3d4efed984df329
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-22 06:45:42 +00:00
Aaron Bohy 5a4a779faf [FIX] web: qunit assert: doesNotHaveClass
Before this commit, the result of our custom qunit assert
'doesNotHaveClass' was incorrect when it was called with
several classnames.

For instance
  assert.doesNotHaveClass(<span class="a"/>, 'a b');
passed, whereas it shouldn't.

closes odoo/odoo#49892

X-original-commit: c40fc67a130ae8e0f061a89d3a21d2507a0f9ae3
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-21 17:01:01 +00:00
Prakash Prajapati edeb86705b [FIX] web: fix the scroll issue of kanban view with search panel
Currently in kanban view which contains search panel when user click
on kanban dropdown menu then a dropdown menu will be hidden due to
scrollbar of kanban view.

This issue arises from this commit:
https://github.com/odoo/odoo/commit/a95cbbd631a2fa9be62eb42cba43e853fdf4b789

closes odoo/odoo#49791

Task-id: 2204306
Closes: #47586
X-original-commit: d613bb8ba4f5a4d818592a80f4aee2ef67916bc0
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-20 12:15:03 +00:00
Julien Mougenot f50c3298bb [FIX] web: set selection fields' default value in custom filters
Before this commit, the 'selection' fields were treated like 'char' fields in the
"Add Custom Filter" menu of the control panel's filter menu. This meant that their
value was defaulted to "".

Now, the default value of a selection field is its first selection value.

closes odoo/odoo#49772

X-original-commit: 62b62570725bc8eb3d3fa77fd1e8efd7a4fb5d2b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-20 09:28:21 +00:00
Lucas Perais (lpe) 4c1feefd13 [IMP] web: Numeric fields can be non-formatted
This commit introduces a new option in fields inheriting from type Numeric
which is `format`.

By default, Numeric fields are formatted according to their subtypes and locale
Adding, in a view, the option format set to a falsy value
will prevent the field's value from being formatted.

```
<field name="int_field" options="{\'format\': false}"/>
```

Task 2050119
2020-04-17 13:56:08 +00:00
Julien Mougenot 7ace5a986a [FIX] web,lunch: separate search panel domain
Before this commit, the SearchPanel widget was given a single unified domain coming
from the view/controller. The issue was that some modules injected additional leaves
in this domain and there was no way to remove them/separate them from the original
view/controller domain.

Now, another paramater (the `viewDomain`) is given to the SearchPanel, containing
the distinct domain related to the view. The Lunch module has been adapted to give
the `location` domain through this new key.

Note that some tests steps had to be inverted since the method retreiving the
domain of the view/controller is asynchronous (needed by Lunch to give time to the
model to be loaded). It mainly concerns the RPC order which does not matter in this
case.

Task 2239706

closes odoo/odoo#49720

X-original-commit: e895e553899933be14c8abfd8c676b44a7f534d8
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-17 14:21:02 +00:00
Stéphane Debauche 4d843de26b [FIX] web: fix nested o2m edition traceback
There's a traceback when we edit an activity on a campaign

  * Create a child activity
  * Save the activity (not the campaign)
  * Edit again the activity
  * -> Traceback

Introduced in a9cebd5

Task ID 2220930

closes odoo/odoo#49698

X-original-commit: efa8952c39b0bcb0969013dc22e05b5d61ff1c66
Related: odoo/enterprise#9964
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-17 08:09:11 +00:00
Julien Mougenot f7a8f42113 [FIX] web: export/import form state with pure JS
Before this commit, restoring the previously active tab on a form view was done
through programatically clicking on the tab and letting Bootstrap handle the switch
itself. This caused some cases of race condition since the click handler is asynchronous.

Now, classes are applied manually and should not cause any concurrency issue.

closes odoo/odoo#49668

X-original-commit: 214b842cba030f451430ff0d8c3fc1868be515e9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-04-16 14:08:27 +00:00
Michael Mattiello (mcm) f0aa343fe2 [REF] web,mail: use patchMixin and patch instead of utils.patch
This commit replaces the use of utils.patch by the new class patcher and
makes the renderers that are converted to owl patchable.

closes odoo/odoo#47700

Related: odoo/enterprise#9551
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-04-16 07:19:55 +00:00
Michael Mattiello (mcm) dcf9a4c38d [IMP] web: add es6 class patcher
This commit implements a new way to monkey-patch ES6
classes (for instance, Owl Components).

Usage
-----

odoo.module('module.BaseClass', function (require) {
    const patchMixin = require('web.patchMixin');

    // Define your class as usual
    class BaseClass {
        constructor() {
            this.foo = 'foo';
        }
        bar() {
            console.log(this.foo);
        }
    }

    // but export it like this to have a "patchable" version
    return patchMixin(BaseClass);
});

odoo.module('module.Patch', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    BaseClass.patch('key', T =>
        class extends T {
            constructor() {
                super();
                this.foo = 'patched foo';
            }
            bar() {
                super.bar();
                console.log('patched bar()');
            }
        }
    );
});

odoo.module('module.instance', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    const obj = new BaseClass();
    obj.bar();
    // if module.patch is loaded before this module the patch
    // will be apply and calling obj.bar() will log:
    // patched foo
    // patched bar()

    // You can unpatch a patchable class
    BaseClass.unpatch('key');
});
2020-04-16 07:19:25 +00:00
Samuel Degueldre 0b0690a393 [IMP] website, web: add fullscreen mode and frontend keyboard shortcuts
While the edit mode interface is full of useful things, it also adds a
lot of clutter, and alters the page's width and thus, its layout. This
commit adds keyboard shortcut for website editors to use, and allows
them to enter a "fullscreen" mode that hides the editor interface while
remaining in edit mode, allowing the user to have fewer distractions
while editing text content, and a closer rendition of the page's final
layout while editing.

For this, keyboard shortcuts were required, and a few other useful
shortcuts have been added, such as alt-1,2,3 for the navbar, just like
in the backed.

task-2126915

closes odoo/odoo#46953

Related: odoo/enterprise#9295
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-16 09:45:58 +00:00
Romeo Fragomeli f83ba90e90 [FIX] web: avoid "False-Positive"
For testing, we use helpers functions like testUtils.dragAndDrop().

Due to the commit odoo/odoo@de924f41ee
these methods were wrapped by a deprecated function to add a deprecation
warning in the console when these methods are used.

After this commit, the deprecated method will properly propagate the
returned value of the original function. And so if the returned value
is a Promise now we can await this Promise.

This should fix some false positives on runbot in saas-13.3 (e.g. FullCalendar).

closes odoo/odoo#49611

X-original-commit: 33bfe175bf1ba7824a1bef27fd7fa0898dbe8cb3
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-04-16 07:06:24 +00:00
Lucas Perais (lpe) 2ff76674d2 [FIX] web: style attachment company specific always in bytes
Following https://github.com/odoo/odoo/pull/44393

Delete the qweb template `web.styles_company_report`
Recompute company specific style by going into
Settings > Configure Document Layout > change stuff and save
Print a report, in HTML to get an human readable error
(PDF rendering would just ignore the error)

Before this commit, there was an error "could not get asset content"
This was because the css asset created in db had a value of type string
whereas it should have been the same type as b64encode (which is byte-like)

After this commit, there is no error at rendering time

closes #49456

closes odoo/odoo#49529

X-original-commit: 2a7e06663c1281f0cf75f72fc491bc2cc39ef81c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-04-14 12:17:00 +00:00
Michael Mattiello (mcm) 71f2f06c61 [FIX] web: render component in kanban
This commit fixes the kanban view to render components.
Before this commit, when rendering a component an error was thrown.

closes odoo/odoo#49525

X-original-commit: 29c18b53af26752079a49e4ece2419f62f680b5d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-14 11:58:53 +00:00
Damien Bouvy 256c75baf7 [IMP] web: add a <Popover> component
Using bootstrap popover with owl is possible, but with a lot of
friction.

This commit adds a Popover element to ease developments that require
a popover. This component takes 2 props:
  - position='bottom' (optional): 'top', 'bottom', 'left', 'right'
  - title (optional)

Its usage requires setting an `opened` slot for the content of the
popover, whilst the 'trigger' of the popover uses the default slot.

E.g.
```xml
<Parent>
 <Popover>
  <t t-set="opened">
   <p>You have opened the popover, congratulations!</p>
   <button t-on-click='_handlerOnParent'>Dispatch cake</button>
  </t>
  <button class="btn btn-primary">Click me!</button>
 </Popover>
</Parent>
```

Note that:
- only one popover can be opened at a time (opening a popover will
close any previously opened popover)
- `Popover` uses `Portal` under the hood, so events are propagated
correctly even though the popover is teleported elsewhere in the dom
(see example in this commit message with `_handlerOnParent`)
- `<Popover>` is registed as a global component in QWeb and does not
need to be added to a Component's subcomponents list

closes odoo/odoo#47710

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-04-14 11:59:04 +00:00
Dhruv Patel dafba22a6c [FIX] web,mail: many2many_tags_email: increase limit
A long time ago, commit [1] increased the limit of displayed badges
inside a many2many_tags widget, from 40 to 1000 (a large limit that
should never been reached with such a widget).

However, this solution was specific to the many2many_tags widget,
and didn't apply to its extensions (like the many2many_tags_email
widget). For instance, open the chatter full composer, add 40
partners in the recipients field and try to add one more: nothing
happens.

This commit sets the limit on the widget itself. That way,
extensions automatically have the same limit, and can override it
if needed.

[1] d4cf4374d1

Task : 2091027

closes odoo/odoo#49488

X-original-commit: 02e41f1131b4ea3ad977cc241a3d447c37195f6e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-14 08:47:15 +00:00
jerome hanke (jhk) 43a2f2051b [FIX] web: css border is consistent on layout external boxed
Steps to reproduce:
- install timesheet
- go to general settings > set documents layout to use 'external_layout_boxed'
- go to timesheets > list view > select all > print > timesheet entries

Previous behavior:
the first line of the report's table is missing a border

Current behavior:
borders are consistent

opw-2230710

closes odoo/odoo#49432

X-original-commit: a70437c0fc8127976ce00b5ec1ef4ae006b28e15
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-04-10 15:18:40 +00:00
qsm-odoo e4a7103517 [FIX] web, web_editor: allow editor instantiation from public user
If for some reason someone wanted to develop a textarea using the
editor which is supposed to work as a public user (like we are trying
to do on Odoo.com), it was not possible. The code was "designed" to
allow it but there was one problem: the lazy loading of the editor
assets required a `render_template` call to the server... which cannot
be done from a public user.

This commit solves the issues by allowing the lazy loading of assets
to use a custom route if required. That route is then used by the editor
"root". That route performs the render_template as a superuser provided
that the view's xmlid is whitelisted.

Note: there was another unauthorized call for public user: the
colorpicker. This was solved by disabling the colorpicker template rpc
for public user, they will still get the default summernote one.

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

closes odoo/odoo#48981

closes odoo/odoo#49398

X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-10 11:54:03 +00:00
qsm-odoo cf85f3b082 [FIX] web: fix ajax.loadAsset cache
The caching system which was implemented was not working if the
same asset was asked twice "at the same time" = "if the second demand
occured while the first demand's RPC loading was taking place".

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

X-original-commit: ba0ac348a3700331cec6955625ca2b6c72600ced
2020-04-10 11:54:02 +00:00
Julien Mougenot ed38c2adb8 [FIX] web: flatten t-call-assets in test assets bundle
Before this commit, the test assets were called with a `t-call-assets` and contained
themselves some other `t-call-assets` to the back-end assets. According to the current
specification, having nested `t-call-assets` will result in a compilation of the
lower levels regardless of the current debugging mode.

Now, the test bundles (desktop & mobile) have been arranged so that their `t-call-assets`
are all called on the same level.

closes odoo/odoo#49306

Related: odoo/enterprise#9797
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-09 14:59:54 +00:00
Lucas Lefèvre a27afdb543 [REF] calendar: Materialize virtual recurring events
TL;DR A bit of magic and ... Pouf ... all virtual events are now real records.

Purpose
=======
The current implementation of recurring events uses "virtual events" to represents all
events in the recurrence. Only one event is stored in the database. All other events are
dynamically built and sent to the web client which sees them as real records.
This implementation is old, difficult to read (6 years of changes and bug fixes) and
has become more and more difficult to maintain.
A fresh start would be welcome.

Specification
=============
When creating a recurring event, a `calendar.recurrence.rule` record should be created.
This model holds the rrule configuration and is responsible to manage events that result
from the rrule.
When a new recurrence is created, all resulting events are also created (stored in the
database). No more virtual events.
To avoid an explosion of events, a maximum of 720 events is created. With 720 events,
a daily recurrence lasts for 2 years and a weekly recurrence lasts for 15 years.
This strategy is used by Google Calendar and seems acceptable in most cases.
A cron job could eventually be introduced to generated more events as the end comes.

This allows to introduce an new rrule end type: 'Forever'. This is actually a shortcut
to create a recurrence running for 720 events.

Inspired by Google Calendar, new possibilities are introduced when modifying a recurring
event (e.g. change the name, add an attendee):
- Modify only this particular event (the event is still part of the recurrence)
- Modify this and following events (events are still in the same recurrence)
- Modify all events

In a similar way, when updating the rrule of an event (e.g. from every Monday to every
Tuesday), the user can choose to:
- Modify this and following events: the recurrence is split. The first part remains
  unchanged but now ends when the second recurrence begins. The second parts is the
  updated rrule.
- Modify only this particular event.
- Modify all events: Forbidden (same as Google Calendar)

Note: when events are "moved" because the rrule changed, the events are not actually
moved. They are unlinked and new events are created (See "Some design choices explained"
section).

Some design choices explained
=============================

Where to store the rrule?
-------------------------
Two options were considered.
1) Store the rrule on an event, each event of the recurrence having a Many2one
to the parent_id, aka the Master Event of the recurrence.

2) Store the rrule on another model: `calendar.recurrence.rule`. Each event in the
recurrence having a Many2one to the recurrence record.

Both options have pros & cons. But there is no clear winner.
However the actual business logic of handling the recurrence creation/update
would be the same.
Where the rrule configuration is stored is the only main difference between both options.
And this is probably the easiest part of implementing recurring events.

With that in mind, option 2) is chosen. It allows to clearly separate recurrence
logic from the events themselves. It is also the "correct" way of modeling data to avoid
many empty columns for most records.

Reusing events on rrule update
------------------------------
When an rrule is modified, events should also be updated.
In most cases, current events are unlinked and new events are created from scratch.
Only events exactly at the same time before and after the rrule update are kept.
Trying to reuse other events would require an obscure and arbitrary heuristic.
(Imagine an rrule every Monday that is changed to every Tuesday and every Friday.
What would you do?).
This implies that any change to a specific event (name change, attendee added, chatter
messages) is lost. This tradeoff seems acceptable as updating an rrule should not be
that frequent. Moreover, Google Calendar also works that way so why not Odoo?

Reusing events on events shifts
-------------------------------
On the calendar view, drag and drop an event to shift the entire recurrence.

One way to handle the recurrence shift is to apply the same timedelta to all events.
Now events are correctly positioned... except for events that were specifically
moved. Those outliers needs special handling.
This also introduces some behavior inconsistencies:
when an rrule is directly modified, events are not reused, but when the rrule is
modified by drag & dropping an event, events are reused. This option needs more code to
handle the shift and the behaviors are not consistent.

The chosen option is to find the rrule configuration from the dragged event (this is
easy) and update the recurrence with those new rrule values. This brings us back to
an rrule update (see above): code reusability yeah; one behavior to rule them all yeah.
One downside is that outliers are lost (but Google Calendar also works that way).

Task 2126717
PR #42031
PR Enterprise odoo/enterprise#8006
2020-04-09 10:56:37 +02:00
Dhruv PatelandMohammed Shekha 923988934a [FIX] web: list: blank line added before data rows
Let's assume an editable="bottom" list view with handle widget and a
required field. Moreover, there are less than 4 records in the list,
so there are empty lines at the bottom of the list s.t. there are
at least 4 rows.

Click to add a row: a new row (in edition) is added at the end of
the list (instead of an empty row). Do not fill the required field,
but instead move another row after the new one (which is still in
edition). Then click on discard.

Before this commit, the discarded row was replaced by an empty one
(s.t. there are always at least 4 rows in the table), but that
empty row wasn't added in the bottom of the list.

task-2209076

closes odoo/odoo#49251

X-original-commit: 22f43536cb78e07aaab3fd806f3c6c5f068824f3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-04-08 14:42:03 +00:00
Kevin Baptiste 58a90952ed [IMP] project: improve usability (back2basics)
* Reword tasks in the sample project
 * Add a "Create and Edit" button on the project creation modal
 * Open the file chooser in "Set a cover image" if there are no images
   set
 * Correclty display the kanban state button on archived task
 * Add a button to list the tasks when deleting a project
 * Open file chooser for cover image: Automatically open the file chooser
   when setting a cover image on a task if there are no attachments to chose
   from.

closes odoo/odoo#47306

Taskid: 2209133
Related: odoo/enterprise#9141
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-08 14:29:50 +00:00
Nisha patel 04af701f76 [FIX] web: Fix the zoom image stick top on search of employee.
Currently, the Employee picture stays on top of the card of the employee
we're looking for. The image does not disappear after a search is validated.
Steps to reproduce:
 >> On employee kanban focus cursor on search panel, then mouse over
to employee image so it will be zoomed, now without mouse leave just
type in the search panel and enter, the big zoomed image stuck on
screen and don't even know how to make it go away.

So in this commit, We fix that on keudown hide the zoom image so
when user search on search panel it will hide the zoom image.
OnShow of zoom bind the generic even keydown and on that just
hide the image so it should not stick on screen.

TaskID : 2212808
Closes : #48253

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-03 07:19:28 +00:00
jvm-odoo c0010f86c0 [FIX] web: fix can export all without access rights
Issue

	- Access rights > archive ir exports & line
	- Any list view
	- Select all > action > export

	Access rights error

	- Export all (next to import button)

	Export done

Cause

	Action > export does a search_read which checks
	access rights

	Export all is bypassing that check

Solution

	Do a search_read when clicking on export all
	before doing the export process

OPW-2230048

closes odoo/odoo#49203

X-original-commit: 8aa89d4c416bdcf3c7f6543f3d32006f9807c938
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-04-08 10:35:08 +00:00
Julien Mougenot 064a11890f [REF] web: remove unused test script in test assets 2020-04-07 14:41:43 +00:00
Julien Mougenot 89dbb49235 [IMP] web: bundle tests
Group all of the test scripts into a single minifyable assets bundle.
This has been done for both the QUnit desktop and mobile suites.

Task 2002399
2020-04-07 14:39:43 +00:00
Julien Castiaux ab4000fb3c [REF] base: Remove deprecated exceptions and osv
TL;DR: remember `osv` and `except_orm` ? You can forget about them.

* Deprecated `except_orm` dropped.
* `UserError` elevated as super type of all user-related
  errors.
* Unused `DeferredException` dropped.
* Unused `QWebException` dropped (real one is in `qweb.py`).
* `MailDeliveryException` made a python exception.
* `name` legacy exception attribute made an alias of the python standard
  `args[0]` attribute and deprecated.
* `value` legacy exception attribute dropped.
* `exception_type` RPC error response key dropped.
* Deprecated `osv` module dropped.
* `--osv-memory-age-limit` cli option made an alias of
  `--transient-age-limit` and deprecated.

The `odoo.exceptions.Warning` have long been a deprecated alias to
`UserError`. It is going to be removed in a future version but first we
explicitly deprecate it with a warning.

The `odoo.exceptions.DeferredException` was a very old internal
exception, it has been removed without deprecation notice as it is never
raised.

The `odoo.exceptions.except_orm` has been a deprecated exception type
with deprecation warning for 5 years, it has been removed in favor of
UserError which becomes the super class of all user-related errors.

The `odoo.base.models.ir_mail_server.MailDeliveryException` was
inheriting `except_orm`. As it is not related to a user error but is
more of a problem an admin much take care of, the exception has been
made a Python error.

The `exception_type` JSON key in RPC error responses was holding an
hardcoded value derived from the exception type. Its usage has been
dropped in favor of the `name` JSON key that holds the precise exception
name. Again as it was hardly used in the source code (beside the crash
manager) it has been dropped without deprecation warning.

Since we are here trying to clean odoo custom exceptions, we are also
deprecating the `name` exception attribute in favor of the more standard
`args[0]` attribute.

The `name` (along with `value`) were two attributes used to raise
`except_orm` exceptions before the introduction of `UserError`,
`AccessError` and related exceptions. The `name` attribute, at the time,
was holding the exception type/title. Nowadays it contains the error
message. The `value` attribute, at the time, was holding the error
message. Nowadays it is no more used.

The `osv` module contains very old deprecated aliases. There is no
simple way to log a deprecation warning for osv, osv_memory and
osv_abstract but as they have not been in use for ages, they have been
removed too. To be consistent, the `--osv-memory-age-limit` cli option
has been made a deprecated alias to the `--transient-age-limit`.

closes odoo/odoo#45723

Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-08 08:41:17 +00:00
Christophe Monniez 640e63e371 [FIX] web: temporarily skip broken tests
After cb76a0022, three more Qunit tests were found to fail randomly.

closes odoo/odoo#49190

X-original-commit: 9809c53e65059d53a9f115ab29ef02583f84bdb5
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-08 08:42:32 +00:00