From 7c1c4def22a72b9a6f6806d70a865594ae14386c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 20 Feb 2025 16:20:25 +0700 Subject: add CR voucher type account --- indoteknik_custom/models/res_users.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indoteknik_custom/models/res_users.py') diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index 31b84ae3..63942bb5 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -71,6 +71,13 @@ class ResUsers(models.Model): if not vouchers: return None return ', '.join(x.code for x in vouchers) return None + + def get_voucher_code_switch_account(self, type): + if type == 'switch_account': + vouchers = self.env['voucher'].get_active_voucher([('account_type', 'in', ['all','company'])]) + if not vouchers: return None + return ', '.join(x.code for x in vouchers) + return None def check_access(self, model, mode): assert mode in ('read', 'write', 'create', 'unlink', 'import', 'export'), 'Invalid access mode' -- cgit v1.2.3 From 093bd33ba36ba123a53853e7407e534f9f23734b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 21 Feb 2025 10:21:34 +0700 Subject: add voucher info in email approve switch account --- indoteknik_custom/models/res_users.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indoteknik_custom/models/res_users.py') diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index 63942bb5..b0864f2c 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -70,11 +70,8 @@ class ResUsers(models.Model): 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 - - def get_voucher_code_switch_account(self, type): if type == 'switch_account': - vouchers = self.env['voucher'].get_active_voucher([('account_type', 'in', ['all','company'])]) + vouchers = self.env['voucher'].get_active_voucher([('excl_pricelist_ids', 'not in', [1]), ('apply_type', 'in', ['all', 'brand']), ('account_type', 'in', ['all', 'company']), ('visibility', 'in', ['public'])]) if not vouchers: return None return ', '.join(x.code for x in vouchers) return None -- cgit v1.2.3