summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-01-15 10:01:14 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-01-15 10:01:14 +0000
commite7c181dbc0cf45a7ffcead50851c0b498c93e15e (patch)
tree7b656969cf2657d0f1d0123d1d7c7c7eeb429bd0 /indoteknik_custom/models
parent26688e4143d28f6a03eaf3f860ab25142ea7ca23 (diff)
parent5f0026f595b28f937b1ee06828555586333892b3 (diff)
Merged in iman/switch-account (pull request #267)
Iman/switch account
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/res_users.py10
-rw-r--r--indoteknik_custom/models/user_company_request.py4
2 files changed, 12 insertions, 2 deletions
diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py
index fb9e8bfb..31b84ae3 100755
--- a/indoteknik_custom/models/res_users.py
+++ b/indoteknik_custom/models/res_users.py
@@ -36,11 +36,21 @@ class ResUsers(models.Model):
for user in self:
template.send_mail(user.id, force_send=True)
+ def send_company_request_mail_switch(self):
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request_switch')
+ for user in self:
+ template.send_mail(user.id, force_send=True)
+
def send_company_request_approve_mail(self):
template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request_approve')
for user in self:
template.send_mail(user.id, force_send=True)
+ def send_company_switch_approve_mail(self):
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_switch_approve')
+ for user in self:
+ template.send_mail(user.id, force_send=True)
+
def send_company_request_reject_mail(self):
template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request_reject')
for user in self:
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py
index 3de3d751..af8a86ba 100644
--- a/indoteknik_custom/models/user_company_request.py
+++ b/indoteknik_custom/models/user_company_request.py
@@ -14,7 +14,7 @@ class UserCompanyRequest(models.Model):
('rejected', 'Reject'),
], string='Approval')
similar_company_ids = fields.Many2many('res.partner', compute="_compute_similar_companies", string="Similar Companies")
-
+ is_switch_account = fields.Boolean( string='Switch Account', default=False)
@api.depends('user_input')
def _compute_similar_companies(self):
for record in self:
@@ -102,7 +102,7 @@ class UserCompanyRequest(models.Model):
self.user_id.property_payment_term_id = user_company_id.property_payment_term_id if user_company_id else self.user_company_id.property_payment_term_id
self.user_id.property_supplier_payment_term_id = user_company_id.property_supplier_payment_term_id if user_company_id else self.user_company_id.property_supplier_payment_term_id
self.user_company_id.active = True
- user.send_company_request_approve_mail()
+ user.send_company_switch_approve_mail() if vals.get('is_switch_account') == True else user.send_company_request_approve_mail()
else:
new_company = self.env['res.partner'].create({
'name': self.user_input