From 2179620aa7feab7d7d6e95694af004277e57d928 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Wed, 31 Aug 2022 15:31:41 +0000 Subject: [PATCH] [REM] hr_timesheet: remove QRCode for app store and play store This commit removes all custom codes to create a QRCode to get the link of the Timesheet Awesome App, the link is sufficient to download the mobile app. closes odoo/odoo#99362 Related: odoo/upgrade#3840 Related: odoo/enterprise#30942 Signed-off-by: Laurent Stukkens (ltu) --- addons/hr_timesheet/__manifest__.py | 3 - .../src/app_store_widget/app_store_widget.js | 71 ------------------- .../app_store_widget/app_store_widget.scss | 3 - .../src/app_store_widget/app_store_widget.xml | 23 ------ .../static/src/js/qr_code_action.js | 18 ----- .../src/js/timesheet_config_form_view.js | 62 ---------------- .../static/src/xml/qr_modal_template.xml | 11 --- .../views/res_config_settings_views.xml | 8 ++- 8 files changed, 6 insertions(+), 193 deletions(-) delete mode 100644 addons/hr_timesheet/static/src/app_store_widget/app_store_widget.js delete mode 100644 addons/hr_timesheet/static/src/app_store_widget/app_store_widget.scss delete mode 100644 addons/hr_timesheet/static/src/app_store_widget/app_store_widget.xml delete mode 100644 addons/hr_timesheet/static/src/js/qr_code_action.js delete mode 100644 addons/hr_timesheet/static/src/js/timesheet_config_form_view.js delete mode 100644 addons/hr_timesheet/static/src/xml/qr_modal_template.xml diff --git a/addons/hr_timesheet/__manifest__.py b/addons/hr_timesheet/__manifest__.py index abb6c43b1bf..741c15e59ca 100644 --- a/addons/hr_timesheet/__manifest__.py +++ b/addons/hr_timesheet/__manifest__.py @@ -58,9 +58,6 @@ up a management by affair. 'web.qunit_suite_tests': [ 'hr_timesheet/static/tests/**/*', ], - 'web.assets_qweb': [ - 'hr_timesheet/static/src/**/*.xml', - ], }, 'license': 'LGPL-3', } diff --git a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.js b/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.js deleted file mode 100644 index eb49624c313..00000000000 --- a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.js +++ /dev/null @@ -1,71 +0,0 @@ -/** @odoo-module */ - -import { registry } from "@web/core/registry"; -import { _t } from "@web/core/l10n/translation"; -import { Dialog } from "@web/core/dialog/dialog"; -import { useService } from "@web/core/utils/hooks"; -import { isAndroid, isIOS } from "@web/core/browser/feature_detection"; -import { standardWidgetProps } from "@web/views/widgets/standard_widget_props"; - -const { Component } = owl; - -const configs = { - apple: { - alt: "Apple App Store", - className: "o_config_app_store", - src: "project/static/src/img/app_store.png", - storeUrl: "https://apps.apple.com/be/app/awesome-timesheet/id1078657549", - }, - google: { - alt: "Google Play Store", - className: "o_config_play_store", - src: "project/static/src/img/play_store.png", - storeUrl: "https://play.google.com/store/apps/details?id=com.odoo.OdooTimesheets", - }, -}; - -class AppStoreWidget extends Component { - setup() { - this.dialog = useService("dialog"); - this.config = configs[this.props.type]; - } - - openQRDialog() { - if ( - (this.props.type === "apple" && isIOS()) || - (this.props.type === "google" && isAndroid()) - ) { - this.env.services.action.doAction({ - type: "ir.actions.act_url", - url: this.config.storeUrl, - }); - } else { - this.dialog.add(AppStoreQRDialog, { url: this.config.storeUrl }); - } - } -} -AppStoreWidget.template = "hr_timesheet.AppStoreWidget"; -AppStoreWidget.props = { - ...standardWidgetProps, - type: { type: String }, -}; -AppStoreWidget.extractProps = ({ attrs }) => { - return { - type: attrs.type, - }; -}; - -class AppStoreQRDialog extends Component { - setup() { - this.title = _t("Download our app"); - this.qrCodeUrl = `/report/barcode/?barcode_type=QR&value=${this.props.url}&width=256&height=256&humanreadable=1`; - } - - viewApp() { - window.open(this.props.url, "_blank"); - } -} -AppStoreQRDialog.components = { Dialog }; -AppStoreQRDialog.template = "hr_timesheet.AppStoreQRDialog"; - -registry.category("view_widgets").add("hr_timesheet.app_store_widget", AppStoreWidget); diff --git a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.scss b/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.scss deleted file mode 100644 index 5c480670577..00000000000 --- a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.scss +++ /dev/null @@ -1,3 +0,0 @@ -.o_widget.o_widget_hr_timesheet\.app_store_widget { - display: contents; -} diff --git a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.xml b/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.xml deleted file mode 100644 index a0d11f14471..00000000000 --- a/addons/hr_timesheet/static/src/app_store_widget/app_store_widget.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
-

Scan this QR code to get the Awesome Timesheet app:

-
-
- -
- - - - -
-
- -
diff --git a/addons/hr_timesheet/static/src/js/qr_code_action.js b/addons/hr_timesheet/static/src/js/qr_code_action.js deleted file mode 100644 index 774ec367aab..00000000000 --- a/addons/hr_timesheet/static/src/js/qr_code_action.js +++ /dev/null @@ -1,18 +0,0 @@ -odoo.define('hr_timesheet.qr_code_action', function (require) { - "use strict"; - -const AbstractAction = require('web.AbstractAction'); -const core = require('web.core'); - -const QRModalAction = AbstractAction.extend({ - template: 'hr_timesheet_qr_code', - xmlDependencies: ['/hr_timesheet/static/src/xml/qr_modal_template.xml'], - - init: function(parent, action){ - this._super.apply(this, arguments); - this.url = _.str.sprintf("/report/barcode/?barcode_type=QR&value=%s&width=256&height=256&humanreadable=1", action.params.url); - }, -}); - -core.action_registry.add('timesheet_qr_code_modal', QRModalAction); -}); diff --git a/addons/hr_timesheet/static/src/js/timesheet_config_form_view.js b/addons/hr_timesheet/static/src/js/timesheet_config_form_view.js deleted file mode 100644 index 250bb0910b9..00000000000 --- a/addons/hr_timesheet/static/src/js/timesheet_config_form_view.js +++ /dev/null @@ -1,62 +0,0 @@ -odoo.define('hr_timesheet.res.config.form', function (require) { - "use strict"; - - const core = require('web.core'); - const config = require('web.config'); - const Dialog = require('web.Dialog'); - const QWeb = core.qweb; - - const _t = core._t; - - const TimesheetConfigQRCodeDialog = Dialog.extend({ - /** - * @override - */ - init: function (parent, url) { - this.url = _.str.sprintf("/report/barcode/?barcode_type=QR&value=%s&width=256&height=256&humanreadable=1", url); - this._super(parent, { - title: _t('Download our App'), - buttons: [{ - text: _t('View App'), - classes: 'btn-primary', - click: function() { - window.open(url, '_blank'); - } - }, { - text: _t('Discard'), - close: true - }], - $content: QWeb.render('hr_timesheet_qr_code', {widget: this}) - }); - }, - }); - - const TimesheetConfigQRCodeMixin = { - async _renderView() { - const self = this; - await this._super(...arguments); - const google_url = "https://play.google.com/store/apps/details?id=com.odoo.OdooTimesheets"; - const apple_url = "https://apps.apple.com/be/app/awesome-timesheet/id1078657549"; - this.$el.find('img.o_config_app_store').on('click', function(event) { - event.preventDefault(); - if (!config.device.isMobile) { - new TimesheetConfigQRCodeDialog(this, apple_url).open(); - } else { - self.do_action({type: 'ir.actions.act_url', url: apple_url}); - } - }); - this.$el.find('img.o_config_play_store').on('click', function(event) { - event.preventDefault(); - if (!config.device.isMobile) { - new TimesheetConfigQRCodeDialog(this, google_url).open(); - } else { - self.do_action({type: 'ir.actions.act_url', url: google_url}); - } - }); - }, - }; - - - return {TimesheetConfigQRCodeDialog, TimesheetConfigQRCodeMixin}; - -}); diff --git a/addons/hr_timesheet/static/src/xml/qr_modal_template.xml b/addons/hr_timesheet/static/src/xml/qr_modal_template.xml deleted file mode 100644 index 2d91c26692e..00000000000 --- a/addons/hr_timesheet/static/src/xml/qr_modal_template.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - -
- -

Scan this QR code to get the Awesome Timesheet app:



- -
-
-
-
diff --git a/addons/hr_timesheet/views/res_config_settings_views.xml b/addons/hr_timesheet/views/res_config_settings_views.xml index ec629d53a42..12bd5414553 100644 --- a/addons/hr_timesheet/views/res_config_settings_views.xml +++ b/addons/hr_timesheet/views/res_config_settings_views.xml @@ -57,10 +57,14 @@
- + + Apple App Store +
- + + Google Play Store +