summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/src
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-07-13 18:38:18 +0200
committerqsm-odoo <qsm@odoo.com>2017-07-24 14:28:35 +0200
commit5f1ef0910bec16415989835b30727b976c80ea4f (patch)
tree504f8196a5186e146ecae49221aa53eae2301721 /addons/barcodes/static/src
parent68766764bc9c2c824c7844bb721a48189d812ef6 (diff)
[IMP] web, *: lazy load dialog xml template
* web_editor, web_planner, website The 'Dialog' class is used in both backend and frontend. Also, lots of actions can be done without the use of any modal. It thus makes sense to lazy load its related xml only when a first modal is opened. This change also allows to get rid of the "base_common.xml" file as the dialog template is the only remaining one in there and, in the future website update, it will allow to not load any static XML file on website page loadings.
Diffstat (limited to 'addons/barcodes/static/src')
-rw-r--r--addons/barcodes/static/src/js/barcode_form_view.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js
index 69a59fdaafa..73df8a3c03f 100644
--- a/addons/barcodes/static/src/js/barcode_form_view.js
+++ b/addons/barcodes/static/src/js/barcode_form_view.js
@@ -285,18 +285,20 @@ FormController.include({
});
}}, {text: _t('Discard'), close: true}],
$content: $content,
- }).open();
- // This line set the value of the key which triggered the _set_quantity in the input
- var $input = this.dialog.$content.find('.o_set_qty_input').focus().val(character);
-
- var $selectBtn = this.dialog.$footer.find('.btn-primary');
- $input.on('keypress', function (event){
- if (event.which === 13) {
- event.preventDefault();
- $input.off();
- $selectBtn.click();
- }
});
+ this.dialog.opened().then(function () {
+ // This line set the value of the key which triggered the _set_quantity in the input
+ var $input = self.dialog.$('.o_set_qty_input').focus().val(character);
+ var $selectBtn = self.dialog.$footer.find('.btn-primary');
+ $input.on('keypress', function (event){
+ if (event.which === 13) {
+ event.preventDefault();
+ $input.off();
+ $selectBtn.click();
+ }
+ });
+ });
+ this.dialog.open();
},
});