Skip to content

Commit

Permalink
[FIX] sign_oca Fix who can sign
Browse files Browse the repository at this point in the history
Before this commit
------------------

Internal user cannot sign a document if this user's partner is a child of some other partner.

Example:
User "Pepe Frog" has a partner "Meme Inc, Pepe Frog" set as `user.partner_id`.
This is because partner "Meme Inc" is set as a company for the partner "Pepe Frog".
So when user Pepe Frog is assigned to a sign request he cannot see the "Sign" button.

After this commit
-----------------

User can see the "Sign" button and sign documents even if related partner has a parent partner set.
  • Loading branch information
ivs-cetmix committed Jul 16, 2024
1 parent 753b8ec commit 8b470aa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sign_oca/models/sign_oca_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,13 @@ def _compute_res_id(self):
for item in self.filtered(lambda x: x.request_id.record_ref):
item.res_id = item.request_id.record_ref.id

@api.depends("signed_on", "partner_id", "partner_id.commercial_partner_id")
@api.depends("signed_on", "partner_id")
@api.depends_context("uid")
def _compute_is_allow_signature(self):
user = self.env.user
for item in self:
item.is_allow_signature = bool(
not item.signed_on
and item.partner_id == user.partner_id.commercial_partner_id
not item.signed_on and item.partner_id == user.partner_id
)

def _compute_access_url(self):
Expand Down

0 comments on commit 8b470aa

Please sign in to comment.