summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/res_users.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/res_users.py')
-rwxr-xr-xindoteknik_custom/models/res_users.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py
index 1e729550..09321fc6 100755
--- a/indoteknik_custom/models/res_users.py
+++ b/indoteknik_custom/models/res_users.py
@@ -32,3 +32,10 @@ class ResUsers(models.Model):
def get_activation_token_url(self):
base_url = self.env['ir.config_parameter'].get_param('site.base.url')
return f'{base_url}/register?activation=token&token={self.activation_token}'
+
+ def get_voucher_code(self, type):
+ if type == 'activation':
+ vouchers = self.env['voucher'].get_active_voucher([('show_on_email', '=', 'user_activation')])
+ if not vouchers: return None
+ return ', '.join(x.code for x in vouchers)
+ return None