-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] pos_esign_request: port to 17.0
- Loading branch information
Showing
36 changed files
with
568 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from . import models | ||
from . import pos_config | ||
from . import pos_session | ||
from . import res_config_settings | ||
from . import res_partner |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.