diff --git a/pos_esign_request/README.rst b/pos_esign_request/README.rst index d5837bb..8ac1e10 100644 --- a/pos_esign_request/README.rst +++ b/pos_esign_request/README.rst @@ -53,7 +53,8 @@ You need two devices: one for POS, another one for taking signs - Open E-Sign Kiosk on the second device - Open menu ``[[ Point of Sale ]] >> Dashboard`` - - Click ``E-Sign`` on the same POS as opened on the first device + - Click three dots on the same POS as opened on the first device + - Click ``E-Sign`` - On the first device click ``Customer`` button @@ -70,6 +71,13 @@ You need two devices: one for POS, another one for taking signs - On the first device for the customer in the **E-Sign** column ✔ sign appears +Known issues / Roadmap +====================== + +Current implementation technically depends on ``pos_self_order`` module. +Meanwhile no functional feature are used, only technical feature of self +order screen. + Bug Tracker =========== diff --git a/pos_esign_request/__manifest__.py b/pos_esign_request/__manifest__.py index 6e9a3ad..fb69a15 100644 --- a/pos_esign_request/__manifest__.py +++ b/pos_esign_request/__manifest__.py @@ -25,9 +25,8 @@ ], }, "data": [ - # "views/assets.xml", # TODO - # "views/pos_config_view.xml", # TODO "views/partner_views.xml", + "views/pos_config_views.xml", "views/res_config_settings_views.xml", ], "demo": [], diff --git a/pos_esign_request/controllers/main.py b/pos_esign_request/controllers/main.py index 7e86784..13eecb2 100644 --- a/pos_esign_request/controllers/main.py +++ b/pos_esign_request/controllers/main.py @@ -1,11 +1,16 @@ +from werkzeug.exceptions import Unauthorized + from odoo import http from odoo.http import request, route -from werkzeug.exceptions import Unauthorized class PosESignExtension(http.Controller): def _verify_pos_config(self, access_token): - pos_config_sudo = request.env['pos.config'].sudo().search([('access_token', '=', access_token)], limit=1) + pos_config_sudo = ( + request.env["pos.config"] + .sudo() + .search([("access_token", "=", access_token)], limit=1) + ) if not pos_config_sudo or not pos_config_sudo.has_active_session: raise Unauthorized("Invalid access token") return pos_config_sudo diff --git a/pos_esign_request/models/pos_config.py b/pos_esign_request/models/pos_config.py index c43efd3..21402a5 100644 --- a/pos_esign_request/models/pos_config.py +++ b/pos_esign_request/models/pos_config.py @@ -10,6 +10,19 @@ class PosConfig(models.Model): ) terms_to_sign = fields.Char(string="Terms & Conditions (ESign)") + def _get_esign_route(self): + self.ensure_one() + base_route = f"/pos-self/{self.id}/esign_kiosk" + return f"{base_route}?access_token={self.access_token}" + + def preview_esign_app(self): + self.ensure_one() + return { + "type": "ir.actions.act_url", + "url": self._get_esign_route(), + "target": "new", + } + @api.depends("ask_for_sign") @api.onchange("ask_for_sign") def _onchange_ask_for_sign(self): diff --git a/pos_esign_request/models/res_config_settings.py b/pos_esign_request/models/res_config_settings.py index 12c8d2d..2e23c95 100644 --- a/pos_esign_request/models/res_config_settings.py +++ b/pos_esign_request/models/res_config_settings.py @@ -1,4 +1,4 @@ -from odoo import fields, models +from odoo import api, fields, models class ResConfigSettings(models.TransientModel): @@ -13,3 +13,10 @@ class ResConfigSettings(models.TransientModel): pos_terms_to_sign = fields.Char( related="pos_config_id.terms_to_sign", readonly=False ) + + @api.onchange("pos_ask_for_sign", "pos_self_ordering_mode") + def _onchange_ask_for_sign(self): + if self.pos_ask_for_sign: + self.pos_self_ordering_mode = "mobile" + else: + self.pos_mandatory_ask_for_sign = False diff --git a/pos_esign_request/readme/ROADMAP.md b/pos_esign_request/readme/ROADMAP.md new file mode 100644 index 0000000..77d1ffc --- /dev/null +++ b/pos_esign_request/readme/ROADMAP.md @@ -0,0 +1,2 @@ +Current implementation technically depends on `pos_self_order` module. +Meanwhile no functional feature are used, only technical feature of self order screen. diff --git a/pos_esign_request/readme/USAGE.md b/pos_esign_request/readme/USAGE.md index e36eb52..6a0410a 100644 --- a/pos_esign_request/readme/USAGE.md +++ b/pos_esign_request/readme/USAGE.md @@ -4,7 +4,8 @@ You need two devices: one for POS, another one for taking signs * Open E-Sign Kiosk on the second device * Open menu `[[ Point of Sale ]] >> Dashboard` - * Click `E-Sign` on the same POS as opened on the first device + * Click three dots on the same POS as opened on the first device + * Click `E-Sign` * On the first device click `Customer` button * Select a Customer diff --git a/pos_esign_request/static/description/index.html b/pos_esign_request/static/description/index.html index 1227909..42b5c79 100644 --- a/pos_esign_request/static/description/index.html +++ b/pos_esign_request/static/description/index.html @@ -376,11 +376,12 @@

POS E-Sign Request

+
+

Known issues / Roadmap

+

Current implementation technically depends on pos_self_order module. +Meanwhile no functional feature are used, only technical feature of self +order screen.

+
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -428,15 +436,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is part of the it-projects-llc/pos-addons project on GitHub.

You are welcome to contribute.

diff --git a/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.js b/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.js index 7539737..a12eac3 100644 --- a/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.js +++ b/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.js @@ -40,7 +40,7 @@ export class ESignKioskPage extends Component { const vals = this.prepareSignValues(); await this.rpc("/pos_esign_request/sign_response", { access_token: this.selfOrder.access_token, - vals: vals + vals: vals, }); this.state.signature = null; } finally { @@ -48,6 +48,10 @@ export class ESignKioskPage extends Component { } } + onClickReject() { + this.state.signature = null; + } + prepareSignValues() { return { partner_id: this.state.partner_id, diff --git a/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.xml b/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.xml index 6da6c7e..32f191b 100644 --- a/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.xml +++ b/pos_esign_request/static/src/app/pages/esign_kiosk_page/esign_kiosk_page.xml @@ -35,28 +35,31 @@
- + >Hide Terms and Conditions - +
diff --git a/pos_esign_request/static/src/overrides/models/pos_bus.js b/pos_esign_request/static/src/overrides/models/pos_bus.js index e5b3eda..ee72129 100644 --- a/pos_esign_request/static/src/overrides/models/pos_bus.js +++ b/pos_esign_request/static/src/overrides/models/pos_bus.js @@ -1,7 +1,7 @@ /** @odoo-module */ -import {patch} from "@web/core/utils/patch"; import {PosBus} from "@point_of_sale/app/bus/pos_bus_service"; +import {patch} from "@web/core/utils/patch"; patch(PosBus.prototype, { // Override @@ -12,12 +12,13 @@ patch(PosBus.prototype, { if (message.type === "ESIGN_RESPONSE" && payload?.partner_id) { const partner = this.pos.db.get_partner_by_id(payload.partner_id); if (partner) { - if (this.pos.waiting_for_esign_partner && this.pos.waiting_for_esign_partner.id == partner.id) { + if ( + this.pos.waiting_for_esign_partner && + this.pos.waiting_for_esign_partner.id === partner.id + ) { this.pos.waiting_for_esign_partner = null; } - // TODO: в каком виде хранить этот sign_attachment_id? - // прям так? partner.sign_attachment_id = payload.attachment_id; // Updates screen in general diff --git a/pos_esign_request/static/src/overrides/payment_screen/payment_screen.js b/pos_esign_request/static/src/overrides/payment_screen/payment_screen.js index cd3ffac..709b4fd 100644 --- a/pos_esign_request/static/src/overrides/payment_screen/payment_screen.js +++ b/pos_esign_request/static/src/overrides/payment_screen/payment_screen.js @@ -25,10 +25,10 @@ patch(PaymentScreen.prototype, { // Customer did not sign and it is mandatory this.popup.add(ErrorPopup, { title: _t("Error"), - body: _t("Customer hasn't sign yet."), + body: _t("Customer hasn't signed yet."), }); return false; - } while (false); + } while (false); // eslint-disable-line no-constant-condition return await super.validateOrder(...arguments); }, diff --git a/pos_esign_request/views/assets.xml b/pos_esign_request/views/assets.xml deleted file mode 100644 index fb56cbd..0000000 --- a/pos_esign_request/views/assets.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - -