Commit Graph
109783 Commits
Author SHA1 Message Date
Martin Geubelle e116a69f25 [FIX] web: properly handle autocomplete attribute
With the new views, the attribute autocomplete on input was no
longer supported. We simply reintroduce its support in this commit.

The basic attribute values are 'on' and 'off' but one may want to use a
random string.

Note that an input with type='password' is a special case: the autocomplete
attribute should always be set to 'new-password' to remove autocompletion
(autocomplete='off' doesn't actually remove the autocompletion).
2017-05-31 14:10:13 +02:00
Martin Geubelle e3fdce9643 [FIX] web: add parent in context after 'Save & New'
When clicking on 'Save & New' in the form view dialog, a new default record
is created. The parent was not correctly set in this record, which causes an
error if `parent` was used in context.
2017-05-31 14:10:12 +02:00
Darshan Kalola 07e1bf7850 [FIX] website: fix error while opening SEO wizard
Before this commit, error was giving on browser console when we open seo wizard which is due to the wrong (this) was passed when initializing Configurator
So in this commit, we passed correct this, to get rid of the error.

(PR #17260)
2017-05-31 09:42:00 +02:00
Aaron Bohy 9369afdada [FIX] web: Form: crash when clicking on buttons in dialogs
In view dialogs (e.g. click on the external button of a many2one
in edit mode), the attribute $buttons of the form controller is
undefined (the buttons are rendered by the dialog directly). The
code that (de)activate the buttons to prevent concurrent clicks
made the assumption that $buttons exist, so it crashed when it
doesn't.
2017-05-30 11:08:52 +02:00
Aaron Bohy 625110d527 [FIX] web: Form: don't reload twice on button clicked
For example: open a draft quotation, click on 'Confirm sale',
before this rev., the record was reloaded twice (each RPC done to
load the data was duplicated). This was actually tested, but the
tests didn't mock well the behavior of the ViewManager, so they
couldn't detect that those RPCs were done twice.
2017-05-30 09:29:06 +02:00
Aaron Bohy 27463eadab [FIX] web: FieldMany2Many: don't save if nothing changed
Suppose that there is a many2many list (non editable) in a form
view. When one of the many2many subrecords is edited (from the
form view in a dialog), it is saved directly when the user clicks
on 'Save' in the dialog.

Before this rev., if the user clicked on 'Save' in the main form
view after editing a m2m subrecord, a 'write' RPC was done, whereas
there were nothing left to save (as the subrecord had already been
saved).
2017-05-29 20:53:40 +02:00
Aaron Bohy 45bce324f3 [FIX] web: BasicModel: correctly apply x2many changes
Suppose that we have a form view with a one2many list (non
editable) containing a record. In edit mode, the user clicks on
that record to edit it in a form view (in a dialog). In this form
view, there is an x2many field that isn't in the list. Before this
rev., it crashed when the user clicked on 'Save' in the dialog
after editing the value of the x2many.

This was because the basic model didn't use the correct fieldsInfo
in that case (it use the fieldsInfo of the list view instead of the
one of the form view, and the x2many field isn't in the list).

Also ensures that the record is correctly saved even if editing the
x2many is the only change done, as this wasn't the case before.
2017-05-29 20:53:40 +02:00
Géry Debongnie 5788ee8a1c [FIX] web: prevent crash when exporting all data
In the list controller, some code to determine the active domain to
export was causing a crash.  It was easy to see: just select all records
in a list view, then click on 'Export' in the sidebar.

Note that the data_export code is still quite old, and did evolve
organically.  It does not conform to our new design principles, in
particular, the way component should communicate. But this is a task for
another day.
2017-05-29 16:20:45 +02:00
qsm-odoo 0bb3f21964 [FIX] web: domain selector's inputs design
Since the new views, the 'o_input' class has to be added on form
elements for them to be correctly styled.
2017-05-29 14:41:58 +02:00
Géry Debongnie bbf724e401 [FIX] web: properly support password attribute for fields
With the new views, the special attribute password was no longer
supported.  We simply reintroduce in this commit proper support to
display password fields with *.

Note: we may want to display passwords with a static number of *, but
this requires some thoughts on the usability of the change. We simply
reintroduce the previous behaviour here.
2017-05-29 12:12:45 +02:00
Géry Debongnie cad943d035 [FIX] web_editor: prevent crash with FieldTextHtmlSimple
If the method commitChange from the widget FieldTextHtmlSimple was
called in mode=readonly, a traceback was displayed.  This is not very
common, because most save operations are done in mode=edit, but it can
happen in readonly mode: when the user clicks on an action button, then
the form view is saved, if necessary.

To reproduce this bug, just open a form view for res.users, and click on
the Change Password button.
2017-05-29 12:12:44 +02:00
Aaron Bohy d76dc17a98 [FIX] web: Pivot: make expand all actually work
The 'Expand All' feature was tested, but in the test environment
RPCs are mocked, and everything is synchronous (by default). So
even if the tests passed, the feature actually didn't work because
of a deferred (the reload deferred) that wasn't waited for.
2017-05-26 15:15:59 +02:00
Aaron Bohy f72bc6c9be [FIX] web: Pivot: don't reload twice on expand all
Before this rev., the option 'reload: false' wasn't correctly
passed when clicking on 'Expand All', and the data was reloaded
twice.
2017-05-26 15:15:59 +02:00
Aaron Bohy 62f446004f [FIX] web: Pivot: don't ignore pivot keys in context
Keys 'pivot_measures', 'pivot_col_groupby' and 'pivot_row_groupby'
can be specified in the context and are meant to be used by pivot
views to determine the initial measures and groupbys. Before this
rev., the new implementation of the pivot view simply ignored them..
2017-05-26 15:15:59 +02:00
Aaron Bohy d9eb4536a5 [FIX] web: MockServer: read_group: group on several fields
Before this rev., the _mockReadGroup function only supported
grouping on one field, and if called with an array of fields of
length > 1, the remaining fields were ignored.

Grouping on several fields is now supported, and some tests had
to be adapted.
2017-05-26 15:15:59 +02:00
Aaron Bohy 5442769c41 [FIX] web: Pivot: correctly return context
allowing to save the current state of the pivot view in the search
view, or to add it to the dashboard.
2017-05-26 15:15:59 +02:00
Aaron Bohy b06bd6495d [FIX] sale_timesheet: use correct pivot keys in context
Keys 'pivot_measures', 'pivot_col_groupby' and 'pivot_row_groupby'
can be specified in the context and are used by pivot views to
determine the initial measures and groupbys. There were typos in
some of them in this sale_timesheet template.
2017-05-26 15:15:59 +02:00
Géry Debongnie 1d57f89380 [FIX] web: properly react when save operation fails (form)
Before this commit, the save method in the basic model did not properly
react when the rpc fails.  In that case, the returned deferred stayed
indefinitely in the 'pending' state.  This is a big problem, because the
basic controller put that deferred in a mutex.  As a result, every
subsequent operations (including field changes!) were indefinitely delayed.

To reproduce the issue, you can find any form view where some python
business logic will cause a fail in some cases.  For example, create a
new inventory adjustement, click on 'Start inventory', then add a line
in the x2many with the same product as another line.  Saving that record
will fail, but then, the form view is broken: no interaction will work.
2017-05-26 15:02:36 +02:00
Géry Debongnie dcde0aaf30 [FIX] web: recompute decoration classnames when necesssary
Before this commit, row decorations were only computed at the initial
rendering for a list view, then never recomputed.  Most of the time, it
is not an issue, but list view can be edited, and in that case, it may
be a problem.  With this commit, we just override the confirmChange
method to recompute the various decorations.

Note that in bonus, decorations now works in realtime, when editing a
list view (in saas-15, they simply did not work when editing a record)

Also, we now use the same evaluation context as everything else in the
web client: the eval context from the record, not some custom handmade
context like before.
2017-05-26 15:02:31 +02:00
Géry Debongnie 9009c5375e [FIX] web: fix various issues with eval contexts
Eval contexts are not easy... They should be different when sent to the
server and when evaluated in the web client.  In this commit, we fix
some small issues:

- when evaluated on the web client, x2manys should be a list of ids,
  when sent to the server, it should be a list of commands
- dates should be converted to string
- always add current_date in the evaluation context, as a magic key (it
  was previously only available in row decoration context evaluations)
2017-05-26 15:02:29 +02:00
Géry Debongnie 0c28dbf969 [FIX] web: ActionManager: protect set/get scrolltop methods
Here is what could happen before this commit: open a record (let's say
project.task) in form view.  Then, on the sidebar (actions), choose
Merge Selected Tasks), choose a task, and click on Merge. What happens
next is a traceback.

Here is a more precise description of what happened:
- the formview dialog for the merge action closes, which triggers a
  reload for the main formview
- the merge action returned an action description for an act_window
- the action manager instantiated a new viewmanager and prepare the form
  view, which is an async operation (need to load some data to display
  the form)
- the previous view manager (initial one) completes its reload, which
  makes it rerender the view, which triggers a DOM_updated event
- the new view manager see this event, and tries to call getScrollTop on
  the current view controller, but there are no controller yet, it is
  not ready.

We could argue that some of these events should not happen (for example,
if we will open a new view manager action, why do we reload the current
view manager?).  But solving these issues is a more deep architectural
problem (we probably will rewrite the actionmanager/view manager layer
at some point).

It could also be argued that in any case, the method getScrollTop should
not crash (same for setScrollTop).  Sadly, these methods are fragile,
because some changes in the loading behaviour of a view may break them.
So, in any case, protecting them against unexpected traceback is a
worthwile investment.
2017-05-24 17:26:39 +02:00
Géry Debongnie 737a2618b5 [IMP web: improve list benchmarks
With this commit, we just slightly improve list benchmarks, to make them
go through a wider variery of code.

Since we aim to use these benchmarks to track changes in performance
through various versions, it is useful to have a good version in
saas-16.
2017-05-24 17:26:37 +02:00
Géry Debongnie a3441cfb56 [FIX] web: handle 'required' attribute in x2many+onchange
Before doing an onchange in a x2many, the basic model tries to evaluate
if the line is valid or not.  In that computation, we used the
field.required property instead of using the required modifier.  This
commit had to move the modifier handling from the BasicRenderer to the
BasicModel, in order to use it in the _isX2ManyValid method.
2017-05-24 11:37:38 +02:00
Martin Geubelle fc82e1e40a [FIX] mrp: correctly replace inputs in pdf_viewer widget
In the extended template `HiddenInputFile` there are actually two inputs
(one for image only and another one).

This widget needs to replace both of them otherwise the file selector will
be opened twice.
2017-05-24 08:25:23 +02:00
Aaron Bohy 460c21f765 [FIX] web: Kanban: various bugs in grouped mode
This rev. fixes the next three bugs:
 - the dataPoints representing each group didn't have the parentID
   attribute set
 - when quick creating a record, the res_ids and count attributes
   of the group, and of the parent weren't correctly updated
 - when quick creating a record, the environment (view_manager)
   wasn't correctly updated

The combination of thoses bugs produced the following crash. Open
a grouped kanban view (e.g. project.task), quick create a record,
open that record in form view (note that the pager was wrong, it
indicated 0/x, where x number of records), delete the record ->
the form is supposed to load the next record, but it
crashed because it couldn't get its id (trying to read id null).
2017-05-24 08:25:22 +02:00
Aaron Bohy 38dfe6c51d [FIX] board: properly render with twice same action
Before this rev., the dashboard wasn't rendered correctly when
the same action (same action id) was several times in the
dashboard.

For instance, if the dashboard contained the list and kanban view
of an action, both views were rendered in the same block, leaving
the other one empty. Moreover, (un)foldeing one automatically
(un)folded the other one.

This was because the action id was used to identify each view, but
this id is not unique in the dashboard. We now use a generated id
instead, which is unique.
2017-05-24 08:25:22 +02:00
Adrien Dieudonne a1e1b0b933 [FIX] web_editor: allow html widget for html fields
Before this commit, it was not possible to set the 'html' widget
for a field in Studio.

Even if this is the default widget for the form view, it not the
case for the kanban view. You need to precise each widget you
want to use (for performance reasons).

opw-744254
2017-05-24 08:23:05 +02:00
David Monjoie 374295bf84 [FIX] web: save should not re-read fields if none were changed
Previously, it used to reload its data when the user clicked
multiple times on save, even though there were only changed
fields during the first initial save, all the other queued
ones have no changes at all and, as such, should not trigger
additional reloads.
2017-05-23 11:41:17 +02:00
David Monjoie 3460bda520 [FIX] web: disable stat buttons until action resolution
Previously, it was possible to click multiple times on stat
buttons while still waiting for the result of a previous button
click. This could end up with the web client in strange states
or, worse, lead to tracebacks. Because of this, we decided to
disable the buttons once one of them is clicked and restore
them afterwards.

By doing this, we encovered a place in the code where a failed
deferred would not be properly forwarded back to the caller,
which meant, in our case, that the buttons would not be
enabled back in case the action failed. This is now fixed.

Initial methods to fix this issue used to break the test below.
Because the label of the assertion this used to break was
contradictory with the value it was actually expecting, we
decided to fix it as well.
2017-05-23 11:41:15 +02:00
David Monjoie e783844f5b [FIX] web: fix missing tests for discard buttons update
Previously, the buttons were not updated properly after discarding
from an editable list view. The user was stuck with "Discard" even
though there was nothing to discard anymore, and he could not create
a new record either since the "Create" button was invisible.

This was fixed by 3aad756. I originally did a different fix which
has since been rendered useless, but the tests I wrote are still
meaningful since they are testing a different case than the commit
which fixed the issue.
2017-05-23 11:41:14 +02:00
Harshad Modi 109b319d64 [FIX] web: send date string in server compatible format
Languages like Arabic (ar_SY), Hindi(hi_IN) do not use english digits to describe dates, and moment.js format function will keep these characters.  So, the server will get date strings, and will be unable to use them.

To see the problem, just type moment().locale('ar_SY').format('YYYY-MM-DD') into a browser console.

In this commit, we simply force the locale to 'en' before sending data to the server.

PR #17156
2017-05-23 10:34:08 +02:00
Adrien Dieudonne 12bf5bb926 [FIX] web: FieldMany2ManyCheckBoxes: label not clickable
Before this commit, it was only possible to click on input to
change the value of the many2many_checkboxes widget.
For better consistency, we must allow to click on labels.
2017-05-22 14:55:47 +02:00
Géry Debongnie 4b8c34be15 [FIX] web: properly evaluate context with x2m
The motivation for this commit was to fix a wrong evaluation context for
x2m fields: it was using a list of res_id, which may contain virtual
ids.

For example, it could be seen in the form view for journal entries:
adding the first line (field line_ids) was fine, but clicking on 'Add an
item' a second time caused a crash.  The reason was that the line_ids
was explicitely added to the context in the view, and the second time we
add a line, the web client sent a list looking like this [35,
'virtual_43'] to the server, in the nameget context.

The proper behaviour is to send a list of commands for those fields.
This means that we had to do some non trivial changes in the
getEvalContext method: we stop using the get method with raw: true.  It
was nice to use the same method, but the eval context is actually
different that the values returned by the get method.  That was the
motivation to introduce the 'noUnsetNumeric' flag, but now, we simply
create another method and let each method do its own work.

TLDR: eval contexts are hard...
2017-05-22 14:25:30 +02:00
Aaron Bohy 967978c96e [FIX] web: Kanban: correctly mute 'Create' button
In Kanban views, the 'Create' button must be muted (btn-default)
in grouped mode, if there is no column and if the column quick
create feature is enabled (as in this case, the first action
should be to create a column).

Before this rev, it was actually muted if there were no record, no
matter if there were columns or not.

This was because the 'count' attribute of dataPoints was used to
determine the number of columns, but this attribute represents
the number of records in the dataPoint (i.e. the sum of the number
of records in each groups).

This particular case was tested, but the test passed thanks to
another bug (we incremented the 'count' attribute in the kanban
model when creating a new group, whereas we shouldn't).
2017-05-22 13:06:47 +02:00
Aaron Bohy 95b853ad2d [FIX] web: List: right align aggregate values
... in group headers, and in footers.
2017-05-22 13:06:10 +02:00
Aaron Bohy 3bb2b69d4a [FIX] web: Form: right align subtotals
The subtotals displayed in the oe_subtotal_footer (e.g. sale.order
form view) should be right aligned. Before this rev. this wasn't
the case for monetary fields, they are now displayed 'inline-flex',
whatever the form mode (before the new views, they were
'inline-flex' only in edit mode).

Credit goes to @qsm-odoo.
2017-05-22 13:06:10 +02:00
Yannick Tivisse 3a9d3a735d [IMP] website_customer: Add Sector of Activity on customer references
- Add a "Filter by Industry" filter on top of the "Filter by Country" on the main /customers page. It should work similarly to the filter by "Level" in the /partners page of crm_partner_assign, but would filter on the customer's industry (With "All Industries") etc.
	- (Cfr www.odoo.com/customers vs www.odoo.com/partners for live examples)
- The search input field on the main /customer page should search on the Industry field as well
- Add the "Industry" info to the /customers index, e.g. like a badge: http://i.imgur.com/Nzjeck9.png
- Add the "Industry" info to the website_customer.details template, e.g. like a badge or in the address block on the left
2017-05-22 11:30:11 +02:00
Yannick Tivisse 9a572f8eec [IMP] base: Add a new model 'Sector of Activity' used on partners
purpose
=======

We need to store and produce reports about customer activity sectors to improve references mechanism.

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

- add a new model res.partner.industry "Sector of Activity"
    - fields:
        - name (translatable)
        - full_name (translatable)
        - active
    - add minimalist form and list views (à la Contact Tags)
    - menu: Sales/Settings/Contacts/Contact Industries  (Technical Settings only)
    - ACL: R for group_user, CRUD for group_system
- add a default XML data file to preload res.partner.industry with the ISIC 2008 aka NACE rev.2 level 1: https://docs.google.com/a/odoo.com/spreadsheets/d/1IrGbHIaaDDkBAS2uGABeNRPndtYbyVBVoYYpQNXnhnY/edit?usp=sharing
    - Note: we leave it as an option for end-users to import their own industries, because there are many competing standards: ISIC, NACE, NAICS, OKVED, etc.
    - Each standard also has different hierarchical levels, and we only use the top level one by default.
- add a m2o industry_id ("Sector of Activity") on res.partner towards res.partner.industry
    - add industry_id in partner form view, in Sales & Purchase > Misc, only visible when contact type is Company
    - No quick create for this field
2017-05-22 11:30:11 +02:00
Géry Debongnie ed603399f9 [FIX] mrp: always use sequence on 'unbuild' creation
The mrp.unbuild model creates a name based on a sequence if no name is
given in the value dictionary.  This was fine before the new views,
because the field name (in the form view) was marked readonly, so the
value 'New' was not actually sent to the server.

However, this was changed with the new views: readonly fields are always
sent on create/write operations, if they have been modified.  This is a
problem for the mrp.unbuild model, because this means that each new
record as effectively the same name: 'New'.

So, we simply always use the sequence-based names in the create
operation, when the name is 'New', instead of the value given as parameter.
2017-05-22 11:29:35 +02:00
Géry Debongnie 8b94bf8b28 [FIX] web: form: remove o_field_invalid class when not necessary
Before this commit, the o_field_invalid class was not removed once an
invalid field becomes valid, until the user saves the form view (which
will rerender the full view anyway)
2017-05-22 10:07:33 +02:00
Géry Debongnie 3aad756d32 [FIX] web: properly handles ESC in editable lists
It is not really easy to handle discard operations.  We need to handle
the discard in editable lists, and in x2manys. This is not exactly the
same code, but most of this was done by moving the discard method from
the formcontroller to the basic controller.

With this commit, the user can now discard the changes for the current
record by pressing ESC.  If the record is new, it will remove it, if
not, it will ask for confirmation before.
2017-05-22 10:07:33 +02:00
Géry Debongnie a60ae43835 [FIX] web: prevent navigation when line is invalid in o2m
The issue that we fix in this commit is the following: open a form view
with a o2m with one required field, and the o2m is editable.  When
adding a new line, it is invalid (since the field with required), but
when pressing ENTER, the editable list tries to navigate away, which
will discard the current line (in the unselectRow method), before
completing the move_to_next_line.  So, at this point, the list editable
create a new (empty) record, and we are back to square one, but with a
visible flicker and no information on what happened.

To fix this issue, we simply check that the renderer can be saved when
moving to next line.  If it is not (the line is invalid), then we simply
abort the move.

Notes:
* this behaviour worked fine in list view, because the canBeSaved check
  is made by the saveRecord method in listController
* it looks like the protection should be put into unselectRow, but this is
  not true (at least, in the current state): in some cases, calling
  unselectRow with invalid state should result in discarding the current row
  (in a new line in a o2m, when the record is not dirty, for example), and
  the list editable renderer does not know if this is the case or not.
  However, if the unselect action comes from a navigation event, then we want
  to avoid discarding the current row.
2017-05-22 10:07:32 +02:00
Géry Debongnie 8436150ae5 [FIX] web: bad interaction between m2o, onchange and editable list
When a many2one (in an editable list) with an onchange was edited, it
could happen that a modal window asking for confirmation of the creation
of a record was opened when it should not.  Here is what actually could
happen:

* user focus a many2one
* user type something
* user press ENTER (keydown + keyup)
* user press ENTER again
* the onchange comes back
* modal window is open

Because of the onchange, the _reset method was called after the
_onInputKeyup method.  So, the m2o_value was not equal to the
$input.val() and the 'floating' flag was set to true (after the first ENTER).
The second ENTER caused a unselectRow in the editable list, so the input
was focusouted, and the modal is set.  This is basically caused by the
asynchronous behaviour of the onchange.

We simply fix the problem by setting the floating flag back to false in
the keydown method.
2017-05-22 10:07:32 +02:00
Géry Debongnie 3adfa84cd6 [FIX] web: improve many2one edition with onchanges
When a many2one (in an editable list) with an onchange was edited, it
could happen that a modal window asking for confirmation of the creation
of a record was opened when it should not.  Here is what actually could
happen:

* user focus a many2one
* user type something
* user press ENTER (keydown + keyup)
* the onchange comes back
* user press ENTER again
* modal window is open

Because of the onchange, the _reset method was called after the
_onInputKeyup method.  So, the m2o_value was not equal to the $input.val() and
the 'floating' flag was set to true, which means that the _onInputFocusout
method (called indirectly by the listeditablerenderer when unselecting the row)
was forced to open a confirm dialog.

We simply fix the problem by setting the floating flag back to false in the
reset method.
2017-05-22 10:07:32 +02:00
Géry Debongnie 28eadb3d6e [FIX] web: improve navigation in field many2one
Before this commit, when the user write some text in a many2one, then
press ENTER, the key event will trigger a navigation move, which will
validate the field, and move the focus to the next line.  The same issue
happens when pressing TAB.

With this commit, we simply stop the propagation, and preventdefault the
event that cause the selection.
2017-05-22 10:07:31 +02:00
Géry Debongnie 5e913677a5 [FIX] web: prevent crash when downloading pivot view
The download feature in the pivot view was broken since we introduced
the new views.  Simply clicking on the download button caused a
traceback.
2017-05-22 09:34:49 +02:00
Géry Debongnie af021f223b [FIX] web: apply onchange when m2o or m2m is edited
Before this commit, when editing a many2one (with an onchange) by
clicking on the small form button on the right, then changing something,
then saving the modal dialog, no onchange was triggered, because,
technically, the value of the many2one was not changed, only the values
from the record pointed by the many2one were.

The same remarks applies to many2manys.

To see this issue in odoo, you can open a product (technically, a
product.template) from the 'Catalog' menu in sales, then edit it, then
click on the small form view icon next to Internal Category.  This is a
many2one (categ_id) with an onchange.  In the form view dialog, change
something, for example costing method, then save.  The res_id of the
internal category was not changed, but an onchange should still be
triggered.
2017-05-22 09:31:15 +02:00
Aaron Bohy da152cfdbf [FIX] web: SelectCreateDialog: don't erase domain
When a SelectCreateDialog was opened with a given domain, this
domain was completely lost if the user wrote a new domain (or
groupby) in the searchview, whereas they should be concatenated.
2017-05-19 15:51:57 +02:00
Aaron Bohy 702835682e [FIX] web: fetch specialData of fields in x2many form
Suppose that there is a one2many list in a form view containing
a field F, displayed with no widget, and that F is also displayed
in the one2many form view (opened when clicking on a record of the
list), but that in this form view, F is displayed with a widget
requiring specialData (additional data to fetch alongside the
record), e.g. widget="domain".

Before this rev., it crashed when this happened because those
specialData weren't loaded when opening the related record.

Credit goes to @pga-odoo for reporting the bug and reproducing it
in a test.
2017-05-19 15:51:57 +02:00
Aaron Bohy c929a81e8f [FIX] web: DebounceField: do nothing after widget destruction
DebounceFields debounce the function that notify field changes to
their environment (using _.debounce). It may happen that this
function is called once the field widget is destroyed (e.g.
type something in a char field and quickly click on Save, the
function is called directly by _commitChanges, but the debounced
call is still pending). It may be a problem if the subsequent
code does something like this.getSession().some_key, as if the
widget is destroyed, it has no parent that can provide it the
session, and thus it crashes.

Also rename attribute _debouncedStarted into _isDirty as it makes
much more sense.
2017-05-19 15:51:57 +02:00