diff options
Diffstat (limited to 'indoteknik_custom')
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 20 | ||||
| -rw-r--r-- | indoteknik_custom/views/res_users.xml | 8 | ||||
| -rw-r--r-- | indoteknik_custom/views/user_company_request.xml | 10 |
3 files changed, 30 insertions, 8 deletions
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index d540b0f6..f86f3872 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -1,4 +1,4 @@ -from odoo import models, fields +from odoo import models, fields, api from odoo.exceptions import UserError from odoo.http import request @@ -13,14 +13,32 @@ class UserCompanyRequest(models.Model): ('approved', 'Approve'), ('rejected', 'Reject'), ], string='Approval') + internal_input = fields.Char(string='Internal Input') + company_type = fields.Char(string='Company Type', compute='_compute_company_type') + + @api.depends('user_company_id.customer_type') + def _compute_company_type(self): + for record in self: + if record.user_company_id.customer_type == 'nonpkp': + record.company_type = 'Non PKP' + elif record.user_company_id.customer_type == 'pkp': + record.company_type = 'PKP' + else: + record.company_type = 'company type belum di set' def write(self, vals): user = self.get_user_by_email(self.user_id.email) user.parent_name = self.user_input is_approve = vals.get('is_approve') + is_internal_input = vals.get('internal_input') if self.is_approve and is_approve: raise UserError('Tidak dapat mengubah approval yang sudah diisi') + if is_internal_input: + if self.user_company_id.nama_wajib_pajak == self.user_company_id.name: + self.user_company_id.nama_wajib_pajak = is_internal_input + self.user_company_id.name = is_internal_input + if not self.is_approve and is_approve: if is_approve == 'approved': self.user_id.parent_id = self.user_company_id.id diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml index 39b9d43e..41c74d72 100644 --- a/indoteknik_custom/views/res_users.xml +++ b/indoteknik_custom/views/res_users.xml @@ -5,7 +5,7 @@ <field name="model_id" ref="base.model_res_users"/> <field name="subject">Aktivasi Akun - Indoteknik.com</field> <field name="email_from">"Indoteknik.com" <noreply@indoteknik.com></field> - <field name="reply_to">noreply@indoteknik.com</field> + <field name="reply_to">sales@indoteknik.com</field> <field name="email_to">${object.login | safe}</field> <field name="body_html" type="html"> <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;"> @@ -65,7 +65,7 @@ <field name="model_id" ref="base.model_res_users"/> <field name="subject">Email Pendaftaran Bisnis dalam Proses Review</field> <field name="email_from">"Indoteknik.com" <noreply@indoteknik.com></field> - <field name="reply_to">noreply@indoteknik.com</field> + <field name="reply_to">sales@indoteknik.com</field> <field name="email_to">${object.login | safe}</field> <field name="body_html" type="html"> <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;"> @@ -125,7 +125,7 @@ <field name="model_id" ref="base.model_res_users"/> <field name="subject">Email Pendaftaran Bisnis Berhasil</field> <field name="email_from">"Indoteknik.com" <noreply@indoteknik.com></field> - <field name="reply_to">noreply@indoteknik.com</field> + <field name="reply_to">sales@indoteknik.com</field> <field name="email_to">${object.login | safe}</field> <field name="body_html" type="html"> <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;"> @@ -186,7 +186,7 @@ <field name="model_id" ref="base.model_res_users"/> <field name="subject">Email Pendaftaran Bisnis Tidak Berhasil</field> <field name="email_from">"Indoteknik.com" <noreply@indoteknik.com></field> - <field name="reply_to">noreply@indoteknik.com</field> + <field name="reply_to">sales@indoteknik.com</field> <field name="email_to">${object.login | safe}</field> <field name="body_html" type="html"> <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;"> diff --git a/indoteknik_custom/views/user_company_request.xml b/indoteknik_custom/views/user_company_request.xml index c9edd3f8..ad121a89 100644 --- a/indoteknik_custom/views/user_company_request.xml +++ b/indoteknik_custom/views/user_company_request.xml @@ -8,12 +8,14 @@ <field name="user_id"/> <field name="user_company_id"/> <field name="user_input"/> - <field + <field name="is_approve" widget="badge" decoration-success="is_approve == 'approved'" decoration-danger="is_approve == 'rejected'" /> + <field name="internal_input"/> + <field name="company_type"/> <field name="create_date"/> </tree> </field> @@ -30,12 +32,14 @@ <field name="user_id" readonly="1"/> <field name="user_company_id" readonly="1"/> <field name="user_input" readonly="1"/> - <field - name="is_approve" + <field + name="is_approve" required="1" decoration-success="is_approve == 'approved'" decoration-danger="is_approve == 'rejected'" /> + <field name="internal_input" /> + <field name="company_type" readonly="1"/> </group> </group> </sheet> |
