diff options
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/res_users.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 4 |
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 |
