Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0 mig pos esign request #4

Merged
merged 23 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
76a9089
:tada pos_esign_request:
KolushovAlexandr Feb 8, 2019
2de0189
:heart_eyes: design updates for esign kiosk
KolushovAlexandr Feb 10, 2019
b3a05d5
:ambulance: incorrect parameters for the request
KolushovAlexandr Feb 17, 2019
1a38726
:boom: design updates for esign/event modules
KolushovAlexandr Feb 18, 2019
81ec6df
:ambulance: upadtes for compatibility with esign modules
KolushovAlexandr Feb 21, 2019
800336b
:book: docs updates for esign
KolushovAlexandr Feb 23, 2019
02a16d9
:heart_eyes: optimized attendee updating
KolushovAlexandr Feb 23, 2019
2b369f6
:rainbow: removed excessive bus
KolushovAlexandr Feb 24, 2019
f7b39de
:ambulance: some small errors about properties of undefound
KolushovAlexandr Feb 24, 2019
15a8eb9
:arrow_up::one::two: pos_esign_request
KolushovAlexandr Aug 26, 2019
43145fa
[MIG] pos_esign_request: port to 14.0
BykovVik Jun 29, 2022
1c11994
[FIX] pos_esign_request: корректно переопределяем ClientListScreen
em230418 Jul 15, 2022
713c2bb
[REF] pos_esign_request: убрал лишний trigger update_customer_list
em230418 Jul 19, 2022
09e04bd
[FIX] pos_esign_request: восстанови утраченный функционал по mandator…
em230418 Jul 19, 2022
cb94648
[FIX] pos_esign_request: поправил проверку перед открытием киоска
em230418 Mar 27, 2023
f6f1fd6
[FIX] pos_esign_request: уточняющее сообщение при открытии esign
em230418 Mar 30, 2023
c037759
[FIX] pos_esign_request: поправил отображение поля sign_attachment_id
em230418 Apr 17, 2023
ef9e6ab
[IMP] pos_esign_request: показываю индикатор того, что у этого пользо…
em230418 Oct 9, 2023
0ff25ce
[FIX] pos_esign_request: убираю ненужный метод, чтобы не вмешивался в…
em230418 Oct 11, 2023
e59b225
[IMP] pos_esign_request: pre-commit auto fixes
em230418 Oct 16, 2024
34bb150
[IMP] pos_esign_request: tidy up
em230418 Oct 16, 2024
1d45c74
[IMP] eslint: файлы из app и overrides воспринимать как es-модули
em230418 Nov 1, 2024
bb0033d
[MIG] pos_esign_request: port to 17.0
em230418 Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parserOptions:

overrides:
- files:
- "**/app/**/*.js"
- "**/overrides/**/*.js"
- "**/*.esm.js"
parserOptions:
sourceType: module
Expand Down
111 changes: 111 additions & 0 deletions pos_esign_request/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
==================
POS E-Sign Request
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c6d26a36e39022c69278b6527be417b36f959e55405bb515b89f706bcfff2f38
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-it--projects--llc%2Fpos--addons-lightgray.png?logo=github
:target: https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_esign_request
:alt: it-projects-llc/pos-addons

|badge1| |badge2| |badge3|

Asks Customer For E-Sign

**Table of contents**

.. contents::
:local:

Configuration
=============

To create a multi-session follow the steps:

- Open menu ``[[ Point of Sale ]] >> Configuration >> Point of Sale``
- Select a POS
- Click ``[Edit]``
- Activate **Ask To Sign** field
- Set **Terms & Conditions**
- If **E-Sign** is required for each purchase then activate **Mandatory
Ask To Sign** field
- Click ``[Save]``

Usage
=====

You need two devices: one for POS, another one for taking signs

- Open a POS on a first device

- Open E-Sign Kiosk on the second device

- Open menu ``[[ Point of Sale ]] >> Dashboard``
- 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

- Click ``E-Sign`` button

- On the second device the form for signing appears

- Let the customer to draw a sign

- Click ``Submit Sign``

- 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
===========

Bugs are tracked on `GitHub Issues <https://github.com/it-projects-llc/pos-addons/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
`feedback <https://github.com/it-projects-llc/pos-addons/issues/new?body=module:%20pos_esign_request%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* IT-Projects LLC

Contributors
------------

- Alexandr Kolusov (https://github.com/KolushovAlexandr)
- Victor Bykov (https://github.com/BykovVik)
- Eugene Molotov (https://github.com/em230418)

Maintainers
-----------

This module is part of the `it-projects-llc/pos-addons <https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_esign_request>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions pos_esign_request/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controllers
33 changes: 33 additions & 0 deletions pos_esign_request/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": """POS E-Sign Request""",
"summary": """Asks Customer For E-Sign""",
"category": "Point of Sale",
"images": [],
"version": "17.0.1.0.0",
"application": False,
"author": "IT-Projects LLC",
"support": "apps@it-projects.info",
"website": "https://github.com/it-projects-llc/pos-addons",
"license": "LGPL-3",
"depends": [
"pos_self_order",
],
"assets": {
"pos_self_order.assets": [
"pos_esign_request/static/src/app/**/*",
"web/static/lib/jquery/jquery.js",
"web/static/src/core/signature/name_and_signature.scss",
"web/static/src/core/signature/name_and_signature.xml",
"web/static/src/core/signature/name_and_signature.js",
],
"point_of_sale._assets_pos": [
"pos_esign_request/static/src/overrides/**/*",
],
},
"data": [
"views/partner_views.xml",
"views/pos_config_views.xml",
"views/res_config_settings_views.xml",
],
"demo": [],
}
1 change: 1 addition & 0 deletions pos_esign_request/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
63 changes: 63 additions & 0 deletions pos_esign_request/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from werkzeug.exceptions import Unauthorized

from odoo import http
from odoo.http import request, route


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)
)
if not pos_config_sudo or not pos_config_sudo.has_active_session:
raise Unauthorized("Invalid access token")
return pos_config_sudo

@route("/pos_esign_request/sign_response", type="json", auth="public")
def submit_kiosk_sign(self, access_token, vals):
config = self._verify_pos_config(access_token)
res = self.update_partner_sign(vals)

if res and config.current_session_id:
session = config.current_session_id
request.env["bus.bus"]._sendone(
session._get_bus_channel_name(), "ESIGN_RESPONSE", res
)

return True

def update_partner_sign(self, vals):
partner_id = vals.get("partner_id", False)
sign = vals.get("sign", False)
if not (partner_id and sign):
return False

Partners = request.env["res.partner"].sudo()
partner_id = Partners.browse(int(partner_id))

Attachments = request.env["ir.attachment"].sudo()
attachment = Attachments.create(
{
"type": "binary",
"name": partner_id.name + "E-Sign",
"datas": sign,
"res_id": partner_id.id,
"res_model": "res.partner",
}
)

partner_id.write(
{
"sign_attachment_id": attachment.id,
}
)

return {
"partner_id": partner_id.id,
"attachment_id": [
partner_id.sign_attachment_id.id,
partner_id.sign_attachment_id.name,
],
}
4 changes: 4 additions & 0 deletions pos_esign_request/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import pos_config
from . import pos_session
from . import res_config_settings
from . import res_partner
45 changes: 45 additions & 0 deletions pos_esign_request/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from odoo import api, fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

ask_for_sign = fields.Boolean(string="Ask To Sign", default=False)
mandatory_ask_for_sign = fields.Boolean(
string="Mandatory Ask To Sign", default=False
)
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):
if not self.ask_for_sign:
self.mandatory_ask_for_sign = False

def sign_request(self, **kw):
for config in self:
if config.current_session_id and config.access_token:
self.env["bus.bus"]._sendone(
f"pos_config-{config.access_token}", "ESIGN_REQUEST", kw
)

def _get_self_ordering_data(self):
res = super()._get_self_ordering_data()
res["config"].update(
name=self.name,
terms_to_sign=self.terms_to_sign,
)
return res
10 changes: 10 additions & 0 deletions pos_esign_request/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_res_partner(self):
res = super()._loader_params_res_partner()
res["search_params"]["fields"].append("sign_attachment_id")
return res
22 changes: 22 additions & 0 deletions pos_esign_request/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from odoo import api, fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_ask_for_sign = fields.Boolean(
related="pos_config_id.ask_for_sign", readonly=False
)
pos_mandatory_ask_for_sign = fields.Boolean(
related="pos_config_id.mandatory_ask_for_sign", readonly=False
)
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
7 changes: 7 additions & 0 deletions pos_esign_request/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class Partner(models.Model):
_inherit = "res.partner"

sign_attachment_id = fields.Many2one("ir.attachment", "E-Sign")
3 changes: 3 additions & 0 deletions pos_esign_request/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
9 changes: 9 additions & 0 deletions pos_esign_request/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To create a multi-session follow the steps:

* Open menu `[[ Point of Sale ]] >> Configuration >> Point of Sale`
* Select a POS
* Click `[Edit]`
* Activate **Ask To Sign** field
* Set **Terms & Conditions**
* If **E-Sign** is required for each purchase then activate **Mandatory Ask To Sign** field
* Click `[Save]`
3 changes: 3 additions & 0 deletions pos_esign_request/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Alexandr Kolusov (https://github.com/KolushovAlexandr)
- Victor Bykov (https://github.com/BykovVik)
- Eugene Molotov (https://github.com/em230418)
1 change: 1 addition & 0 deletions pos_esign_request/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Asks Customer For E-Sign
2 changes: 2 additions & 0 deletions pos_esign_request/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 18 additions & 0 deletions pos_esign_request/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
You need two devices: one for POS, another one for taking signs

* Open a POS on a first device
* Open E-Sign Kiosk on the second device

* Open menu `[[ Point of Sale ]] >> Dashboard`
* 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
* Click `E-Sign` button

* On the second device the form for signing appears
* Let the customer to draw a sign
* Click `Submit Sign`

* On the first device for the customer in the **E-Sign** column ✔ sign appears
Loading
Loading