[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) <ltu@odoo.com>
This commit is contained in:
@@ -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',
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -1,3 +0,0 @@
|
||||
.o_widget.o_widget_hr_timesheet\.app_store_widget {
|
||||
display: contents;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="hr_timesheet.AppStoreWidget" owl="1">
|
||||
<img t-att-alt="config.alt" class="img img-fluid mt-1" t-att-class="config.className" style="height: 85% !important; cursor: pointer;" t-att-src="config.src" t-on-click="openQRDialog"/>
|
||||
</t>
|
||||
|
||||
<t t-name="hr_timesheet.AppStoreQRDialog" owl="1">
|
||||
<Dialog title="title">
|
||||
<div style="text-align:center;">
|
||||
<h3>Scan this QR code to get the Awesome Timesheet app:</h3>
|
||||
<br/>
|
||||
<br/>
|
||||
<img class="border border-dark rounded" t-att-src="qrCodeUrl"/>
|
||||
</div>
|
||||
<t t-set-slot="footer">
|
||||
<button class="btn btn-primary" t-on-click="viewApp">View App</button>
|
||||
<button class="btn" t-on-click="props.close">Discard</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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};
|
||||
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="hr_timesheet_qr_code">
|
||||
<div style="text-align:center;">
|
||||
<t t-if="widget.url">
|
||||
<h3>Scan this QR code to get the Awesome Timesheet app:</h3><br/><br/>
|
||||
<img class="border border-dark rounded" t-att-src="widget.url"/>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -57,10 +57,14 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-lg-3 pe-0">
|
||||
<widget name="hr_timesheet.app_store_widget" type="apple"/>
|
||||
<a href="https://apps.apple.com/be/app/awesome-timesheet/id1078657549" class="align-middle" target="_blank">
|
||||
<img alt="Apple App Store" class="img img-fluid h-100 o_config_app_store" src="project/static/src/img/app_store.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-lg-3 pe-0">
|
||||
<widget name="hr_timesheet.app_store_widget" type="google"/>
|
||||
<a href="https://play.google.com/store/apps/details?id=com.odoo.OdooTimesheets" class="align-middle" target="_blank">
|
||||
<img alt="Google Play Store" class="img img-fluid h-100 o_config_play_store" src="project/static/src/img/play_store.png"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user