Vincent SchippefiltandAlexandre Kühn 48a53f2ea5 [FIX] web: improve automatic creation of new lines in x2many in forms
This commit fixes a few issues with the previous implementation of the
automatic addition of new lines in x2many inside forms

1. Before this commit, when there is a change of mode in a formview
`edit` -> `readonly` -> `edit`, there may be some cases that
mistakenly and automatically opens a modal.

This case occurs in a form view with a x2many field whose 1st inner
focusable element opens a modal (e.g. "Add an item").

In `edit` mode:
	1. Open this modal from the x2many
	2. Close the modal
	3. Change mode to `readonly`
	4. Change mode to `edit`
> the same modal is automatically open.

This is due to the tracking of the last activated field that persists
after a change of mode. Since the last activated field in the 1st
`edit` is the x2many, it is granted the focus at the beginning of the
2nd `edit`, which automatically opens the modal.

This commit fixes the issue by resetting the tracking of the last
activated field when there is a change of mode. As a result, at the
beginning of the 2nd `edit`, the focus should always be on the 1st
field.

2. Before this commit, if the focus was moved out of the form (to a modal
for instance) then back, the form would re-activate the last field, which
is the x2many and would re-add a new line. This behavior is not correct
and now going back from a modal to a form does not add a new line.

Co-authored-by: Alexandre Kühn <aku@odoo.com>
2018-09-25 16:49:23 +02:00
2018-09-21 16:32:59 +02:00
2015-09-08 15:45:09 +02:00
2017-12-12 17:19:01 +01:00
…
2015-09-08 17:58:38 +02:00
2018-04-18 15:59:05 +02:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

Then follow the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%