Skip to content

Commit f240779

Browse files
committed
[IMP] sign_stamp: add company stamp support for users
Technical Changes: - stamp_sign_stamp and stamp_sign_stamp_frame field in res.users - Implemented and methods in to fetch user stamp and frame. - Allows displaying the company stamp and frame in signature dialogs for sign requests.
1 parent 35b5462 commit f240779

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

sign_stamp/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

sign_stamp/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import res_user
2+
from . import sign_request_item

sign_stamp/models/res_user.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from odoo import models, fields
2+
3+
STAMP_USER_FIELDS = ["stamp_sign_stamp", "stamp_sign_stamp_frame"]
4+
5+
6+
class ResUsers(models.Model):
7+
_inherit = "res.users"
8+
9+
@property
10+
def SELF_READABLE_FIELDS(self):
11+
return super().SELF_READABLE_FIELDS + STAMP_USER_FIELDS
12+
13+
@property
14+
def SELF_WRITEABLE_FIELDS(self):
15+
return super().SELF_WRITEABLE_FIELDS + STAMP_USER_FIELDS
16+
17+
stamp_sign_stamp = fields.Binary(string="Company Stamp", copy=False, groups="base.group_user")
18+
stamp_sign_stamp_frame = fields.Binary(string="Company Stamp Frame", copy=False, groups="base.group_user")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from odoo import models
2+
3+
4+
class SignRequestItem(models.Model):
5+
_inherit = "sign.request.item"
6+
7+
def _get_user_stamp(self, stamp_type='stamp_sign_stamp'):
8+
self.ensure_one()
9+
stamp_user = self.partner_id.user_ids[:1]
10+
if stamp_user and stamp_type in ['stamp_sign_stamp']:
11+
return stamp_user[stamp_type]
12+
return False
13+
14+
def _get_user_stamp_frame(self, stamp_type='stamp_sign_stamp_frame'):
15+
self.ensure_one()
16+
stamp_user = self.partner_id.user_ids[:1]
17+
if stamp_user and stamp_type in ['stamp_sign_stamp_frame']:
18+
return stamp_user[stamp_type]
19+
return False

0 commit comments

Comments
 (0)