File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
addons/html_builder/static/src/core Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ export class SavePlugin extends Plugin {
12
12
static shared = [ "save" ] ;
13
13
14
14
resources = {
15
- handleNewRecords : this . handleMutations ,
15
+ handleNewRecords : this . handleMutations . bind ( this ) ,
16
+ start_edition_handlers : this . startObserving . bind ( this ) ,
16
17
// Resource definitions:
17
18
before_save_handlers : [
18
19
// async () => {
@@ -33,6 +34,10 @@ export class SavePlugin extends Plugin {
33
34
get_dirty_els : ( ) => this . editable . querySelectorAll ( ".o_dirty" ) ,
34
35
} ;
35
36
37
+ setup ( ) {
38
+ this . canObserve = false ;
39
+ }
40
+
36
41
async save ( ) {
37
42
// TODO: implement the "group by" feature for save
38
43
const proms = [ ] ;
@@ -173,13 +178,19 @@ export class SavePlugin extends Plugin {
173
178
return escapedEl ;
174
179
}
175
180
181
+ startObserving ( ) {
182
+ this . canObserve = true ;
183
+ }
176
184
/**
177
185
* Handles the flag of the closest savable element to the mutation as dirty
178
186
*
179
187
* @param {Object } records - The observed mutations
180
188
* @param {String } currentOperation - The name of the current operation
181
189
*/
182
190
handleMutations ( records , currentOperation ) {
191
+ if ( ! this . canObserve ) {
192
+ return ;
193
+ }
183
194
if ( currentOperation === "undo" || currentOperation === "redo" ) {
184
195
// Do nothing as `o_dirty` has already been handled by the history
185
196
// plugin.
You can’t perform that action at this time.
0 commit comments