Skip to content

Commit

Permalink
[FIX] sign_oca: When it has been signed, we should be unable to resig…
Browse files Browse the repository at this point in the history
…n it
  • Loading branch information
etobella committed Aug 11, 2023
1 parent 56ef46f commit 8d166c4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sign_oca/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def get_sign_oca_access(self, signer_id, access_token):
)
except (AccessError, MissingError):
return request.redirect("/my")
if signer_sudo.signed_on:
return request.render(
"sign_oca.portal_sign_document_signed",
{
"signer": signer_sudo,
"company": signer_sudo.request_id.company_id,
},
)
return request.render(
"sign_oca.portal_sign_document",
{
Expand Down
3 changes: 3 additions & 0 deletions sign_oca/models/sign_oca_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class SignOcaRequest(models.Model):
to_sign = fields.Boolean(compute="_compute_to_sign")
signatory_data = fields.Serialized(default=lambda r: {}, readonly=True)
current_hash = fields.Char(readonly=True)
company_id = fields.Many2one(
"res.company", default=lambda r: r.env.company.id, required=True
)

def cancel(self):
self.write({"state": "cancel"})
Expand Down
38 changes: 38 additions & 0 deletions sign_oca/templates/assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,44 @@
</t>
</t>
</template>
<template id="portal_sign_document_signed">
<t t-call="web.layout">
<t t-set="head">
<t t-call-assets="web.assets_common" t-js="false" />
<t t-call-assets="web.assets_frontend" t-js="false" />
</t>

<div class="container">
<div class="o_logo">
<img
t-attf-src="/web/binary/company_logo?company={{ company.id }}"
alt="Logo"
/>
</div>

<div class="card">
<div class="card-header">
<h2>Document <t
t-esc="signer.request_id.name"
/> has already been signed</h2>
</div>
<div class="card-body">
<t t-if="signer.request_id.state == 'signed'">
You should have received an email with the final document.<br
/>
Check on your mailbox.
</t>
<t t-elif="signer.request_id.state == 'cancel'">
The document has been cancelled
</t>
<t t-else="">
As soon as all signers have signed the document, you will receive an email with the full document
</t>
</div>
</div>
</div>
</t>
</template>
<template t-name="sign_oca_template_mail">
<div>
<span>
Expand Down

0 comments on commit 8d166c4

Please sign in to comment.