diff options
| author | Yannick Tivisse <yti@odoo.com> | 2020-08-13 09:25:21 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-08-13 10:53:00 +0000 |
| commit | a37a746b4e0060c834dd700a511ff61350831d1d (patch) | |
| tree | ac8714035df66e8a54871df25c9a496607bef839 /addons/hr_expense/static/src/js/expense_qr_code_action.js | |
| parent | a89b68e7b5d50b750fadae8fb2a006225bec5d4a (diff) | |
[IMP] hr_expense: Improve global UX (back2basics)
closes odoo/odoo#55852
Taskid: 2303951
Related: odoo/enterprise#12394
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/hr_expense/static/src/js/expense_qr_code_action.js')
| -rw-r--r-- | addons/hr_expense/static/src/js/expense_qr_code_action.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/hr_expense/static/src/js/expense_qr_code_action.js b/addons/hr_expense/static/src/js/expense_qr_code_action.js new file mode 100644 index 00000000000..19226545ede --- /dev/null +++ b/addons/hr_expense/static/src/js/expense_qr_code_action.js @@ -0,0 +1,24 @@ +odoo.define('hr_expense.qr_code_action', function (require) { +"use strict"; + +const AbstractAction = require('web.AbstractAction'); +const core = require('web.core'); +const config = require('web.config'); + +const QRModalAction = AbstractAction.extend({ + template: 'hr_expense_qr_code', + xmlDependencies: ['/hr_expense/static/src/xml/expense_qr_modal_template.xml'], + + init: function(parent, action){ + this._super.apply(this, arguments); + const qr_vals = [ + '002', // Version + '1', // Character Set + action.params.url, // Download app url + ]; + this.url = _.str.sprintf("/report/barcode/?type=QR&value=%s&width=256&height=256&humanreadable=1", encodeURI(qr_vals.join('\n'))); + }, +}); + +core.action_registry.add('expense_qr_code_modal', QRModalAction); +}); |
