Commit Graph
11090 Commits
Author SHA1 Message Date
Dhruv Patel 8b6592e4d4 [IMP] web: add test for text paste in searchbar
added test case for text paste in autocomplete in the searchbar using mouse,
it should populate the autocomplete dropdown.

task-2204174

closes odoo/odoo#48251

X-original-commit: 010961ee3eac55a1e885ce918b597943078324f6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-25 11:55:20 +00:00
Romain Estievenart 04cc2b5700 [FIX] web, web_tour: mobile quick search view issues
Now we have the mobile search_panel in enterprise,
this commit simply adapt the Odoo repos part with:

- Css Clean up
- Remove the no longer existing step inside the tour
the button 'o_enable_searchview' no longer exist
inside a M2X dialog

Task ID: 2200099

closes odoo/odoo#48376

Related: odoo/enterprise#9494
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-03-29 14:24:33 +00:00
Nicolas Lempereur 469b1a85d0 [FIX] web: show title for short event in day view
In 13.0, as of 369c20a9 there is some style that will show an event with
bigger font-size and spacing in calendar day view.

In this commit, if an event is short (less than 30 pixels, so less than
45 minutes) we will decrease the spacing to have the same as in week
view and see the event title more easily.

opw-2216654
closes #48391

closes odoo/odoo#48409

X-original-commit: a4d170ad9e73d1d63404532b161911df020b5c36
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-26 09:37:28 +00:00
Nicolas Lempereur f3182c6035 [FIX] translate.py,web: aria-label qweb translation and export
In 12.0 9de1bc0e aria-label translation was added for python views, but:

- aria-label attribute are not exported

- aria-label are not translated for JS view rendering

So by default, aria-label would only be translated for python views that
had the same aria-label term in a translatable element (eg. "title"
attribute).

opw-2222504
closes #48255

closes odoo/odoo#48275

X-original-commit: 6b6b11ea2f8391f1f195bd1650531f77b6bed729
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-24 14:46:30 +00:00
Luis González 680b2797d8 [FIX] web: Add missing aria attributes to selectable menu items
Some menus contain items that are selected/checked when they're
activated, e.g. when a filter is applied, the menu item corresponding to
that filter is checked. However, that information of what items are
checked and what don't, is not reported correctly using aria attributes.

To solve the above, the following is performed:
- Attribute `aria-checked` is set accordingly, usually using the same
  logic as the clas `selected`
- Attribute `role` is set to `menuitemcheckbox` or `menuitemradio`
  instead of `menuitem`, so `aria-checked` is applicable

This applies on the following cases:
- Standard topbar's menus: Filter, Group by and Favorites
- The company switcher widget

closes odoo/odoo#48301

X-original-commit: 64c0b47c0e8e8fdd3fa9b1bc13f2b49b6f49f4e1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-25 09:57:53 +00:00
jvm-odoo eaf62e948a [FIX] web: fix grouping content overlap
Issue

	- Be in multicompany
	- Have a company with a long name
	- Install Accounting
	- Settings > Currencies > Dollars
	- Click on the smart button "Rates"
	- Group by company

	Company name and rate overlap

Cause

	In `_computeDefaultWidths`, we use the method
	`_getColumnWidth` which returns a width depending on the
	field type.

	When you use group by, the fields order doesn't change
	so the company name in the group line have the width
	of the date field (92px) and there is nothing that
	limits the place that the string can takes so there
	is overflow.

Solution

	As it seems to be something very accurate, I think the
	safest solution would be to use the `o-text-overflow`
	saas mixin.

OPW-2218143

closes odoo/odoo#48318

X-original-commit: 2898dd4577e12326cbe83dce9fdbdef0e32d51e6
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-25 10:06:49 +00:00
Luis González 5dda9a709e [FIX] web,mail: Harmful or incomplete aria-label attributes
Some elements contain superfluous `aria-label` attributes, which
overrides any default useful information. For instance, some dropdown
menus contain the `aria-label` "Dropdown menu" (e.g. the company
switcher), which doesn't add any useful information, as dropdown menus
are already labelled correctly using `aria-expanded`.

This change applies on the following buttons:
- Schedule an activity
- View attachments
- View followers
- Switch company
- Open user options from systray
- The widget `state_selection`

closes odoo/odoo#48317

X-original-commit: e3c7f66e89d7be39dfa4cc3d6b038c6f4a114aa5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-25 12:39:02 +00:00
Julien Mougenot 70d426b948 [FIX] web: fix dataManager loading caches
Before this commit, coming back on a view when in 'debug=assets' would erase the
previously loaded favorites with an 'undefined' value. This was due to an incorrect
cache invalidation mechanism in the DataManager's load_views' method.

Now the views and filters caches are properly loaded if any of them has been invalidated.

closes odoo/odoo#48085

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-24 09:57:00 +00:00
Dhruv Patel 2d5dd1448f [FIX] web: restrict to open sidebar forcefully in pdf viewer initially
Before this commit, when PDF viewer opens, it opens the sidebar forcefully.

Now with this commit, we have restricted to open the sidebar on initial load
by passing the false value to the forceOpen flag, we did this changes directly
in the library file itself as the file loads in iframe so we can not change the
file from outside by overriding the existing function or parameter.

task-2209742

closes odoo/odoo#47458

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-16 13:17:00 +00:00
Mohammed Shekha 5353fb2496 [IMP] web: trim FieldEmail widget value
before this commit, email widget was not trimming value and due to which
space aroung email value remain as it is added by user.

after this commit, email widget will trim the value and remove leading/trailing
space.

task-2197432

closes odoo/odoo#47470

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-24 08:02:13 +00:00
fja-odoo 65e8473464 [FIX] web: change invalid font awesome icon
fa-delete does not exist => fa-trash

introduced by: 6692919d1e

task-2211899

closes odoo/odoo#48207

X-original-commit: 1b830bf1c7211dad5c93ac6929c7c395b32f3f90
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-23 14:18:30 +00:00
fw-bot 94fee8a8dd Cherry pick of b0c5370fd25191b4e537805b006fba02fffe2b23 failed
stdout:

stderr:

closes odoo/odoo#48197

Error: could not apply b0c5370fd25... Revert "[FIX] web, purchase, sale: fix no currency in calendar view"
Hint: after resolving the conflicts, mark the corrected paths
Hint: with 'git add <paths>' or 'git rm <paths>'
Hint: and commit the result with 'git commit'
X-original-commit: e8d6f1eae0f4f9c0f4df78553b7d51a03087940f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-23 13:17:51 +00:00
Hardik Prajapati 3998fa8dc1 [IMP] web: removed extra space in export field list
before this commit:
when manually adding field in export wizard, string has extra space in
begining.

after this commit:
manually added field in export field list doesn't contain any extra
spaces.

task-2065433

closes odoo/odoo#36759

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-09-12 10:01:47 +00:00
Hiral Bhavsar 73834a659c [IMP] calendar, web: private events shouldn't be editable/deletable
Before this commit, when user attempts to edit or delete a private
event without being an attendee, it raises an access right error.

This commit disables edit and delete buttons in this case, in
addition to hide event details.

task-2151150

Closes https://github.com/odoo/odoo/pull/42569

closes odoo/odoo#42569

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-03-20 10:09:10 +00:00
Nisha patel 8978b0bc8f [IMP] web: Show company icon on property(company dependent) field
Purpose Of the task is, we need a visual cue on those fields to let
the user know that their value is company-specific.

So, in this commit On company depedent field we added a building
icon with title 'Values set here are company-specific' next to the
label in the form view.

closes odoo/odoo#47178

Taskid: 2001748
Closes: #47178
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-23 08:48:02 +00:00
Aaron Bohy f6c06bd0b8 [FIX] web: nested x2many with non inline views
Let's assume a form view with an x2many list, containing itself
an x2many field (no widget, so simply displaying the number of
records). When a record of the list is clicked, a form view
opens and displays the same sub x2many field, with widget
many2many_tags. Both list and form views of the x2many aren't
inline (thus have to be fetched on demand).

Before this commit, it crashed when the user clicked on a row
of the x2many list.

The bug has been introduced by a9cebd5a, which wrongly removed the
code handling this specific situation. At least, now we have a
test attesting that this code isn't useless.

Note that the diff isn't as scary as it looks like (we just added
an if/else, and thus indented the former code inside the else
clause).

closes odoo/odoo#48116

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-20 13:40:42 +00:00
Kaushalya Mandaliya e1b257bd8a [IMP] web: prevent tooltip duplication on a responsible in the calendar
Before this commit,
Hovering on a responsible on the right column of the calendar will:
    - show a classic yellow tooltip
    - show a custom tooltip with a bigger image

After this commit,
Hovering on a responsible on the right column of the calendar will:
    - show a custom tooltip with a bigger image if image exist
      else, show classic tooltip

PR odoo/odoo#45353
Task-2194828

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-03-04 09:50:58 +00:00
Mathieu Duckerts-Antoine 1959e7756a [FIX] web: do not activate falsy search defaults
Before this commit, if an action context would contain a key/value pair
like

    search_default_foo : 0

the filter foo would be activated, while it should be not considered
as default.

The present commit fixes that situation.

closes odoo/odoo#47958

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-20 08:06:41 +00:00
Yannick Tivisse 86691b1379 [FIX] web: Fix switch company menu glitch on mobile
Purpose
=======

When being logged on company A and clicking on company B, I should
log into the company A only.

Currently in mobile, the checkbox next to A remains enabled before the
refresh. With this commit, this behavior is fixed.

closes odoo/odoo#48045

Taskid: 2205603
X-original-commit: 19f196c0afd73c5d64b612aa413e6e6772e0c288
Related: odoo/enterprise#9373
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-19 15:31:08 +00:00
Julien Mougenot 71af8ee4f8 [FIX] web: update clickAll test helpers
Before this commit and following the refactoring of the home menu and the control
panel to the Owl framework, some of the helpers of the 'clickEverywhere' test have
not been properly updated to the new classes/behaviours.

Now the selectors target the right elements and some actions that were previously
synchronous are now properly awaited (home menu toggling, filter menu interactions,
etc.).

Also slightly changed the behaviour of the clickAll functions:
- requesting a click on a null element will make the test crash (added some conditions
  to avoid this in a standard flow).
- any error crashing the test at a deeper level will be displayed in the console
- an animation frame is awaited after clicking on an element. This is to comply
  with the Owl rendering system.

closes odoo/odoo#47762

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-18 12:33:02 +00:00
Jeremy Kersten 5bdec6351a [FIX] web_editor: allow widget text on field html in studio
Before this commit, widget='text' was not available in web_studio since 'html'
was missing from the supportedFieldTypes list of the TextField.

After this commit you can use widget text (and other derivated type of text).

task-sbu-feedback

closes odoo/odoo#48043

X-original-commit: 34bd90e7fc2aa094eac92b6f635c2d8d933ecb86
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-03-19 15:20:29 +00:00
Aaron Bohy 0b88e862a8 [FIX] web: editable list: activate correct field
We have an editable list with 4 fields:
  - fieldA (say boolean)
  - fieldB with readonly modifier, readonly iff fieldA is true
  - fieldC with readonly modifier, readonly iff fieldA is false
  - fieldD

Add a new row to the list: fieldA being false by default, fieldC
is readonly whereas fieldB isn't.

Change the value of fieldA: fieldB becomes readonly, and fieldC is
now editable.

From that point, before this commit, clicking on fieldC activated
fieldD (instead of fieldC).

The bug occurred since 3fd7b20, which added a delay between
the moment fields are re-rendered (and inserted at the end of
allFieldWidgets) and the moment there previous instances are
destroyed (and the new ones take their place in the list). So when
several fields were re-rendered at the same time, the order in
allFieldWidgets could not match the actual column order anymore,
and cause issues like the one described above.

Part of task 2210323

closes odoo/odoo#48039

X-original-commit: 89b9717c08e148ad94db17d8746faa2312b6a07a
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-19 14:59:50 +00:00
Rémy Baranx (bar) b3d9647695 [IMP] web: use do_action instead of BBQ push_state on RedirectWarning
In the RedirectWarning exception handler, it is better
to use 'do_action()' instead of using a BBQ push_state() and then
a location.reload(), to preserve the context and avoid losing menus
and breadcrumbs for example.

As the RedirectWarning receives only the action ID and not the full
action, a new parameter has been added to be able to provide a context.
This context is added in the 'additional_context' parameter of the do_action()

TaskID: 2168071
2020-03-19 12:59:09 +00:00
Siddarth Gajjar 41822a5022 [IMP] web: improve height of input inside oe_title > h1
studio now supports adding of oe_avatar, in few cases oe_avatar field is added
inside oe_title > h1 and while input is also inside h1 so height of input
increase as we have image tag as a sibling, to fix this set height of input
to fit-content.

task-2172320
Closes #47968

Related: odoo/enterprise#8176
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-19 09:16:50 +00:00
Dharmraj Jhala 7557ac299b [FIX] web: properly set page data in 'ModelFieldSelector' widget
When passing a default field chain to ModelFieldSelector, the page data is
not set correctly for the relational field. To understand the issue :

- login to master enterprise all db branch in runbot (debug mode recommended)
- create a mass mailing, add subject, select 'Contact' in `Recipients` field
- click on domain selector and select 'Company' from ModelFieldSelector popover
- click somewhere else to close the popover
- again open domain selector and observe the popover

Current behavior : fields of  `Contact` are visible in the page even thogh
                   `Company` is selected in the ModelFieldSelector
Expected behavior : fields of `Company` should be visible in the dropdown page

This commit fixes the issue by correctly pushing the page data
in ModelFieldSelector.

task - 2058702

closes odoo/odoo#39548

Related: odoo/enterprise#5370
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-19 09:21:20 +00:00
Julien Mougenot 9cf534f577 [REF] web: properly wait for services to start
When using a mock environment, some services are started and need to be loaded
for some tests to work as intended. Before this commit, we waited for the result
of the `start` method of each service to be resolved. This was flawed because these
methods are all synchronous, so the awaiting period was actually a single microtask
tick.

To clarify this and still make sure that the asynchronous services have enough time
to load properly, the `Promise.all` has been replaced by an Owl next tick method
(with animation frame request).

Consistently waiting for services to be fully ready does not make sense anyway as
we may want to mock a delay during the starting mechanism.

closes odoo/odoo#47865

Related: odoo/enterprise#9328
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-18 14:51:36 +00:00
jerome hanke (jhk) e58db3ff5c [FIX] web: graph view ignores duplicate labels
Steps to reproduce:
- install recruitment
- go to recruitment > configuration > job positions > duplicate a job
and keep the exact same name as the original > change the department
- add any application to the newly created job position
- go to recruitment > applications > all applications > select the
graph view > group by job

Previous behavior:
you only see one of the two jop positions with the same name
the graph view does not handle multiple labels with the same name
and only keeps the latest values when rendering

Current behavior:
duplicate labels are suffixed to prevent the view from confusing them

opw-2214284

closes odoo/odoo#47948

X-original-commit: a77086f8bcb4498361d1183ba8af3d0663cd031b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
2020-03-18 17:22:59 +00:00
Aaron Bohy f79f9c5133 [FIX] web: report client action: mount control panel
Before this commit, the 'mounted' hook of the control panel in the
report client action was never called, because of a missing call
to '_super'. As a consequence, the 'Print' button wasn't displayed.

closes odoo/odoo#47940

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-03-18 16:07:16 +00:00
Julien Mougenot d678d516ef [FIX] web: action menus default select_all
Before this commit, the context sent by an action performed by the action menu
could hold an 'undefined' select_all key, which would cause the context evaluation
to crash.

Now, the select_all key is defaulted to 'false' and does not crash in actions that
do not provide it.

closes odoo/odoo#47745

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-17 08:26:25 +00:00
Nicolas Martinelli a12479aaa8 [FIX] web: rounding error
In JavaScript, the following computation introduces numerical errors:
```
Math.pow(10, -4) = 0.00009999999999999999
Math.pow(10, -5) = 0.000009999999999999999
```

In the context of `round_decimals`, such errors propagate to
`round_precision`, ultimately leading to inconsistencies between Python
and JS (see #47300 for detailed use case).

Instead of computing `Math.pow(10, decimals)`, we parse the scientific
notation to prevent such inaccuracies.

We also introduce tests in line with the Python tests.

opw-2205092

closes odoo/odoo#47694

X-original-commit: cb471897bfa08d1fee6a9f49e90d9c120e1733fc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-16 12:01:57 +00:00
jvm-odoo 3f9c3b475c [FIX] web: fix control panel long breadcrumb
Issue

	- Install CRM and Events
	- Change Azure Interior Name with a
	  very long string
	- Click on "1 Events" smart button

	The view is shifted out of the screen

Cause

	In 12.0, the control panel was separated
	with 2 div where width = 50%

	Now they use flex. (they are still 50% width
	by default)

	The long name is hidden by a `overflow:hidden`
	and there is a `text-overflow: ellipsis` to
	avoid extra-width issue.

	The problem is that there is a `white-space:
	no-wrap;` which force an extra width and
	this cause the shifting.

Solution

	We come back to the 50% even if there is no search view.
	Breadcrumb will always be on the top left area of the screen
	which simplifies the code and avoid jumping left to right
	(taking all the width of the screen) which can be disturbing
	for users.

closes #47063

OPW-2210786

closes odoo/odoo#47603

X-original-commit: 019dc91020a461263c29004ef0c304a8f91abae9
Related: odoo/enterprise#9219
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-13 13:40:26 +00:00
Julien MougenotandMathieu Duckerts-Antoine 804507ef49 [REF] *: Adapt all module tests to the new control panel
Use of the new control panel helpers to increase consistency and change the assertions
according to the new DOM/behaviour (e.g. components removed instead of turning invisible).

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00
Julien MougenotandMathieu Duckerts-Antoine bb8eb766a8 [REF] web: Control panel tests
Use of the new helpers in control panel (and subcomponents) tests and addition
of new tests.

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00
Julien MougenotandMathieu Duckerts-Antoine 18e5416636 [REF] web: Adapt views/actions to new control panel
Some web actions/controllers/viewsl have been adapted to properly instantiate the
newly refactored control panel and update it accordingly. We needed to adapt the
starting mechanism of actions and controllers to ensure that the control panel
instantiation did not delay the loading of any widget.

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00
Julien MougenotandMathieu Duckerts-Antoine fbf347498f [REF] web: Control panel Owl
Refactoring of the control panel with the Owl framework.

The MVC structure of the control panel has been changed to a 'component <-> model'
relationship. As such:
- Removed the old control panel: view/model/controller/renderer
- Created a new Owl Component (ControlPanel)
- Created a new class: the Model (an Owl Store did not fit here) and a newly
  designed ControlPanelModel extending it

Refactored all inner subcomponents, including:
- Pager
- ActionMenus (peviously SideBar)
- Filter menu
    > Custom filter item
- Group by menu
    > Custom group by item
    > Removal of groupby_menu_mixin (and refactored graph controller in sibling commit)
- Time range menu
- Favorite menu
    > Custom favorite item
    > Moved the favorite menu registry to the favorite_menu file
- Search bar
    > Removed and splitted auto-completion dropdown logic between the new SearchBar
      Component (descriptions) and to the new ControlPanelModel (domains).

The templates (all in web/base.xml) have been adapted to the new standards. Most
of the DOM structure remains unchanged with some occasional improvements (replace
hiding with not rendering, removed pointless wrapper divs, etc.).

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00
Julien MougenotandMathieu Duckerts-Antoine 0a129284e4 [IMP] web,*: Enhance test helpers
1. Test utils helpers adapted to properly instantiate the new Owl control panel
2. New file 'test_utils_control_panel' to create a control panel and use helpers
3. New helper: createComponent (creates a generic component, see jsdoc)
4. Use of the new helpers in the current tests (more in sibling commits)
5. Helper 'addMockEnvironment' is now asynchronous
6. Owl config mode set to 'dev' in test suite (props validation)

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 11:39:53 +00:00
Julien MougenotandMathieu Duckerts-Antoine 72f1633532 [REF] web: Move control panel mobile to enterprise
Now that mobile is not supported anymore in community, the mobile layout of the
control panel has been entirely moved to enterprise. This caused some conflicts
with the community mobile test suite (which does not make sense anyway). The failing
tests and related style sheets have been moved as well.

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 09:37:30 +00:00
Julien Mougenot da8790f0bb [IMP] web: Dialog: add option to stop click propagation
There are situations where we don't want clicks to be detected behind an opened
dialog: for example, when a dialog is opened by a dropdown, we may want to keep the
dropdown open while we interact with the dialog.

There is now an option (default: true) to stop clicks propagation when
they arrive at the dialog container.
2020-03-13 09:37:29 +00:00
Julien Mougenot 384e516218 [REF] web: Update generic files
General cleaning of some helpers and generic files. The idea is that they are
less likely to be entirely re-written in the near future so this is a way to
keep the code clean, readable and compliant to the current standards. Changes include:
- Use of async/await when possible
- Use of const/let instead of var
- Removal of underscore.js
- Use of native JS instead of jQuery when possible

The logic of the affected code remains the same.
2020-03-13 09:37:29 +00:00
Julien Mougenot 11ba58a311 [REF] web: Indent and reorganize generic files
The purpose of this commit is to correctly indent and order some generic files.
There is strictly no change in the code logic.
2020-03-13 09:37:29 +00:00
Joseph Caburnay 78beadb748 [REV] web: allow patching getters
This reverts commit d6b854306c.

The reverted commit introduced issues in patching class methods.
Introducing getters in the patch function is not actually compatible
with the original method patching.

Test for patch method is also introduced to guard patch from future
invalid modification that happened.

A more robust  way of patching classes is now being developed.

closes odoo/odoo#47557

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-13 08:41:15 +00:00
Aaron Bohy f692a39677 [FIX] web: FieldMany2ManyTags: failing quick create record
The FieldMany2One allows to quick create record (name_create).
However, sometimes, required fields on the co-model make the
name_create crash. In this case, the FieldMany2one opens a form
view in a dialog to let the user specify those fields, and create
a new record with the 'create' method. This was working fine.

The FieldMany2ManyTags embeds a FieldMany2One to let the user
search for and select or (quick) create tags. In this case, failing
quick creation didn't fallback on the dialog form view, but
displayed a server error instead. This commit fixes this issue.

Bug introduced by 50bf8309f8

Task 2192754

closes odoo/odoo#47183

X-original-commit: 63ab065f3298c13bb19ae1245d7fd2652581b254
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-09 10:31:01 +00:00
jvm-odoo 31551f8e51 [FIX] web: prioritize record context instead of bin_size
This commit allows to pass a bin_size context to False.
Before this commit it wasn't possible because it was
always overriden.

OPW-2208232

closes odoo/odoo#47491

X-original-commit: 17d53cea1043054dfa9c39b16b430539c4082a9d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-12 12:10:11 +00:00
jbm-odoo c4c2430807 [IMP] sign: Add color option for signature
Blue by default

taskID: 2196770
2020-03-11 09:57:55 +00:00
Romain Estievenart 8ec70c9072 [FIX] web: data-mobile on action_manager_act_window
Commit ca4eaf4 introduced the data-mobile attribute, used
to specify options to pass when executing an action, only in
mobile (like using a fullscreen modal).

However, we forgot to add the 'isMobile' check, so the option
was passed in desktop as well.

This commit fixes the issue and adds some tests.

Task ID: 2155601

closes odoo/odoo#47333

X-original-commit: 6cb68a53106fa7326a7f818461418437d5a0df77
Signed-off-by: res-odoo <res-odoo@users.noreply.github.com>
2020-03-10 21:40:19 +00:00
Joseph Caburnay d6b854306c [IMP] web: allow patching getters
Previous implementation of patch (web.utils) only allows patching
methods. This commit allows patching getters as well.

closes odoo/odoo#47047

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-06 09:04:20 +00:00
Damien Bouvy 6bcf02efeb [FIX] web: introduce parser for many2one_reference
Follow-up of d0c852f

The parser of `many2one_reference` was not introduced when the new field
type was created and then later when the formatter was added, which
leads to errors when the web client is trying to set the value of such
fields.

Since the value of this field is an ID, it is parsed as an integer.

closes odoo/odoo#47330

X-original-commit: db1e16bc041e1d892fd1f3ac5b694e12496a32f9
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-10 18:41:00 +00:00
shreya thakrar b3ece2074a [FIX] web: properly set page data in 'ModelFieldSelector' widget
When passing a default field chain to ModelFieldSelector, the page data is
not set correctly for the relational field. To understand the issue :

- login to v11 enterprise all db branch in runbot (debug mode recommended)
- create a mass mailing, add subject, select 'Contact' in `Recipients` field
- click on domain selector and select 'Company' from ModelFieldSelector popover
- click somewhere else to close the popover
- again open domain selector and observe the popover

Current behavior : fields of  `Contact` are visible in the page even thogh
                   `Company` is selected in the ModelFieldSelector
Expected behavior : fields of `Company` should be visible

This commit fixes the issue by correctly pushing the page data
in ModelFieldSelector.

task - 2058702

closes odoo/odoo#47231

X-original-commit: 5746c2705c324b124445f38ead4f75624b3f99e3
Related: odoo/enterprise#9124
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-09 16:46:20 +00:00
Aaron Bohy 43ce727568 [FIX] web: save all values returned by onchange
Let's assume a form view with a boolean field and a one2many field,
displayed for instance with widget many2many_tags. There is an
onchange on the boolean field, which populates the one2many, e.g.
  [[5], [0, 0, {display_name: 'name', other_field: 'value'}]]

Before this commit, only the display_name was sent to the server on
save, because 'other_field' is unknown by the webclient.

Similar situations occurred with one2manys displayed as lists, and
onchanges returning values for fields that aren't in the list.

These situations probably didn't exist in Odoo yet, but a pending
task on website event adds one.

This commit ensures that all values returned by the onchange for
the x2many subrecords are sent back to the server when the user
saves.

closes odoo/odoo#46807

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-09 14:14:39 +00:00
Aaron Bohy f894b6a1d8 [FIX] web: x2many: use correct viewType
This commit fixes two issues that occurred in the following
situation: in a form view, have a one2many field F1 displayed as a
list, that contains another one2many field F2, displayed with
widget many2many_tags (in the list), and with a list in the form
(in the dialog). In the dialog, the list of F2 displays a
field, say 'name', which has an onchange that sets 'display_name'.
Moreover, there is an onchange in the (main) form view, that
populates F1 and F2, for instance, it returns something like: {
  F1: [[5], [0, 0, {
       F2: [[5], [0, 0, {
            display_name: 'xxx',
	    name: 'xxx',
       }]]
  }]]
}

1) If the user opens a related record in F1, and adds (in the
dialog) a related record in F2, then validates the dialog, the
newly created record in F2 isn't correctly displayed in the
many2many_tags (the display_name is `false`), i.e. the onchange
hasn't been applied.

2) If field 'name' in F2 in the list is required, the new record
can't be saved, even if the user enters a correct value.

In both cases, the reason is that we use the incorrect viewType in
datapoints: as we don't specify that we specifically want 'list',
the 'default' one is taken, and we thus use the fieldsInfo of the
many2many_tags, which only knows field 'display_name'. As a
consequence, onchanges aren't correctly applied (issue 1), and
fields aren't correctly reset (issue 2).

Issue reported on task 2189529
2020-03-09 14:14:39 +00:00