summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_api/controllers/api_v1/partner.py19
-rw-r--r--indoteknik_api/controllers/api_v1/user.py330
-rw-r--r--indoteknik_api/models/res_users.py10
-rwxr-xr-xindoteknik_custom/models/res_users.py10
-rw-r--r--indoteknik_custom/models/user_company_request.py4
-rw-r--r--indoteknik_custom/views/res_users.xml156
-rw-r--r--indoteknik_custom/views/user_company_request.xml6
7 files changed, 465 insertions, 70 deletions
diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py
index 885cf3ec..307165b3 100644
--- a/indoteknik_api/controllers/api_v1/partner.py
+++ b/indoteknik_api/controllers/api_v1/partner.py
@@ -141,13 +141,9 @@ class Partner(controller.Controller):
'email': [],
'mobile': []
})
-
- # Mengambil id_user dari request
id_user = self.get_request_params(kw, {
'id_user': ['number']
})
-
- # Mengambil parameter user dari request
params_user = self.get_request_params(kw, {
'company_type_id': ['number'],
'industry_id': ['number'],
@@ -156,17 +152,26 @@ class Partner(controller.Controller):
'alamat_lengkap_text': [],
})
- # Cek validitas parameter
if not params['valid']:
return self.response(code=400, description=params)
- # Mencari partner dan user berdasarkan ID
partner = request.env[self._name].search([('id', '=', params['value']['id'])], limit=1)
user = request.env[self._name].search([('id', '=', id_user['value']['id_user'])], limit=1)
-
if not partner:
return self.response(code=404, description='Partner not found')
+ if not params['value'].get('tax_name'):
+ params['value']['nama_wajib_pajak'] = params['value'].get('name')
+ params_user['value']['nama_wajib_pajak'] = params_user['value'].get('name')
+
+ if not params['value'].get('alamat_lengkap_text'):
+ params['value']['alamat_lengkap_text'] = params['value'].get('street')
+ params_user['value']['alamat_lengkap_text'] = params_user['value'].get('street')
+
+ if not params['value'].get('npwp'):
+ params['value']['npwp'] = "00.000.000.0-000.000"
+ params_user['value']['npwp'] = "00.000.000.0-000.000"
+
# Filter parameter yang memiliki nilai saja untuk partner
params_filtered = {k: v for k, v in params['value'].items() if v}
diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py
index addf2c9f..f651d9fa 100644
--- a/indoteknik_api/controllers/api_v1/user.py
+++ b/indoteknik_api/controllers/api_v1/user.py
@@ -437,8 +437,8 @@ class User(controller.Controller):
@http.route(prefix + 'user/<id>/switch', auth='public', methods=['PUT', 'OPTIONS'], csrf=False)
@controller.Controller.must_authorized()
def switch_account(self, **kw):
- id = kw.get('id')
- user = request.env['res.users'].search([('id', '=', id)], limit=1)
+ id = int(kw.get('id'))
+ user = request.env['res.partner'].search([('id', '=', id)], limit=1)
response = {
'switch': False,
@@ -461,7 +461,14 @@ class User(controller.Controller):
nama_wajib_pajak = kw.get('nama_wajib_pajak', False)
is_pkp = kw.get('is_pkp')
type_acc = kw.get('type_acc', False)
-
+ parent_id = kw.get('parent_id', False)
+ if parent_id:
+ try:
+ parent_id = int(parent_id)
+ except ValueError:
+ parent_id = False
+ else:
+ parent_id = False
response = {
'switch': False,
@@ -473,55 +480,23 @@ class User(controller.Controller):
('company_type', '=', 'company'),
('name', 'ilike', business_name)
]
- match_company = request.env['res.partner'].search(parameter, limit=1)
- match_ratio = 0
- if match_company:
- match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio()
- if match_ratio > 0.8:
- # Create a user company request
- request.env['user.company.request'].create({
- 'user_id': user.partner_id.id,
- 'user_company_id': match_company.id,
- 'user_input': business_name
- })
- else:
- if not nama_wajib_pajak and is_pkp == 'false':
- nama_wajib_pajak = business_name
-
- if not alamat_wajib_pajak and is_pkp == 'false':
- alamat_wajib_pajak = alamat_bisnis
-
- new_company_data = {
+ if parent_id:
+ match_company = request.env['res.partner'].search([('id', '=', parent_id)], limit=1)
+ new_data = {
+ 'email': email_partner,
+ 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp',
'name': business_name if business_name else business_name,
'company_type_id': company_type_id if company_type_id else False,
'industry_id': industry_id,
- 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp',
'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'),
'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'),
'nama_wajib_pajak': nama_wajib_pajak,
'alamat_lengkap_text': alamat_wajib_pajak,
- 'email': email_partner,
'street': alamat_bisnis,
- 'company_type': 'company',
- 'user_id': 3222,
- 'property_account_receivable_id': 395,
- 'property_account_payable_id': 438,
- 'active': False,
}
- new_company = request.env['res.partner'].create(new_company_data)
- request.env['user.company.request'].create({
- 'user_id': user.partner_id.id,
- 'user_company_id': new_company.id,
- 'user_input': business_name
- })
- # user.partner_id.parent_id = new_company.id
- # user.partner_id.customer_type = new_company.customer_type
- # user.partner_id.npwp = new_company.npwp
- # user.partner_id.sppkp = new_company.sppkp
- # user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak
- # user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text
+ match_company.write(new_data)
- if npwp_document:
+ if npwp_document != ' ':
npwp_mimetype, _ = mimetypes.guess_type(npwp_filename)
npwp_mimetype = npwp_mimetype or 'application/octet-stream'
pdf_data = base64.b64decode(npwp_document)
@@ -530,12 +505,12 @@ class User(controller.Controller):
'type': 'binary',
'datas': base64.b64encode(pdf_data),
'res_model': 'res.partner',
- 'res_id': new_company.id,
+ 'res_id': match_company.id,
'mimetype': npwp_mimetype
})
- new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id])
+ match_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id])
- if sppkp_document:
+ if sppkp_document != ' ':
sppkp_mimetype, _ = mimetypes.guess_type(sppkp_filename)
sppkp_mimetype = sppkp_mimetype or 'application/octet-stream'
pdf_data = base64.b64decode(sppkp_document)
@@ -544,11 +519,149 @@ class User(controller.Controller):
'type': 'binary',
'datas': base64.b64encode(pdf_data),
'res_model': 'res.partner',
- 'res_id': new_company.id,
+ 'res_id': match_company.id,
'mimetype': sppkp_mimetype
})
- new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id])
-
+ match_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id])
+ request.env['user.company.request'].create({
+ 'user_id': user.id,
+ 'user_company_id': match_company.id,
+ 'user_input': business_name,
+ 'is_switch_account': True
+ })
+ else:
+ match_company = request.env['res.partner'].search(parameter, limit=1)
+ match_ratio = 0
+ if match_company:
+ match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio()
+ if match_ratio > 0.8:
+ if user.parent_id :
+ new_data = {
+ 'email': email_partner,
+ 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp',
+ 'name': business_name if business_name else business_name,
+ 'company_type_id': company_type_id if company_type_id else False,
+ 'industry_id': industry_id,
+ 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'),
+ 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'),
+ 'nama_wajib_pajak': nama_wajib_pajak,
+ 'alamat_lengkap_text': alamat_wajib_pajak,
+ 'street': alamat_bisnis,
+ }
+ match_company.write(new_data)
+
+ if npwp_document != ' ':
+ npwp_mimetype, _ = mimetypes.guess_type(npwp_filename)
+ npwp_mimetype = npwp_mimetype or 'application/octet-stream'
+ pdf_data = base64.b64decode(npwp_document)
+ npwp_attachment = request.env['ir.attachment'].create({
+ 'name': 'NPWP Document',
+ 'type': 'binary',
+ 'datas': base64.b64encode(pdf_data),
+ 'res_model': 'res.partner',
+ 'res_id': match_company.id,
+ 'mimetype': npwp_mimetype
+ })
+ match_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id])
+
+ if sppkp_document != ' ':
+ sppkp_mimetype, _ = mimetypes.guess_type(sppkp_filename)
+ sppkp_mimetype = sppkp_mimetype or 'application/octet-stream'
+ pdf_data = base64.b64decode(sppkp_document)
+ sppkp_attachment = request.env['ir.attachment'].create({
+ 'name': 'SPPKP Document',
+ 'type': 'binary',
+ 'datas': base64.b64encode(pdf_data),
+ 'res_model': 'res.partner',
+ 'res_id': match_company.id,
+ 'mimetype': sppkp_mimetype
+ })
+ match_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id])
+ else:
+ # Create a user company request
+ request.env['user.company.request'].create({
+ 'user_id': user.id,
+ 'user_company_id': match_company.id,
+ 'user_input': business_name
+ })
+ else:
+ if not nama_wajib_pajak and is_pkp == 'false':
+ nama_wajib_pajak = business_name
+
+ if not alamat_wajib_pajak and is_pkp == 'false':
+ alamat_wajib_pajak = alamat_bisnis
+
+ new_company_data = {
+ 'name': business_name if business_name else business_name,
+ 'company_type_id': company_type_id if company_type_id else False,
+ 'industry_id': industry_id,
+ 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp',
+ 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'),
+ 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'),
+ 'nama_wajib_pajak': nama_wajib_pajak,
+ 'alamat_lengkap_text': alamat_wajib_pajak,
+ 'email': email_partner,
+ 'street': alamat_bisnis,
+ 'company_type': 'company',
+ 'user_id': 3222,
+ 'property_account_receivable_id': 395,
+ 'property_account_payable_id': 438,
+ 'active': False,
+ }
+ new_company = request.env['res.partner'].create(new_company_data)
+ request.env['user.company.request'].create({
+ 'user_id': user.id,
+ 'user_company_id': new_company.id,
+ 'user_input': business_name
+ })
+ # user.partner_id.parent_id = new_company.id
+ # user.partner_id.customer_type = new_company.customer_type
+ # user.partner_id.npwp = new_company.npwp
+ # user.partner_id.sppkp = new_company.sppkp
+ # user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak
+ # user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text
+
+ if npwp_document:
+ npwp_mimetype, _ = mimetypes.guess_type(npwp_filename)
+ npwp_mimetype = npwp_mimetype or 'application/octet-stream'
+ pdf_data = base64.b64decode(npwp_document)
+ npwp_attachment = request.env['ir.attachment'].create({
+ 'name': 'NPWP Document',
+ 'type': 'binary',
+ 'datas': base64.b64encode(pdf_data),
+ 'res_model': 'res.partner',
+ 'res_id': new_company.id,
+ 'mimetype': npwp_mimetype
+ })
+ if user.parent_id:
+ match_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id])
+ else:
+ new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id])
+
+ if sppkp_document:
+ sppkp_mimetype, _ = mimetypes.guess_type(sppkp_filename)
+ sppkp_mimetype = sppkp_mimetype or 'application/octet-stream'
+ pdf_data = base64.b64decode(sppkp_document)
+ sppkp_attachment = request.env['ir.attachment'].create({
+ 'name': 'SPPKP Document',
+ 'type': 'binary',
+ 'datas': base64.b64encode(pdf_data),
+ 'res_model': 'res.partner',
+ 'res_id': new_company.id,
+ 'mimetype': sppkp_mimetype
+ })
+ if user.parent_id:
+ match_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id])
+ else:
+ new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id])
+ request_company = self.get_user_by_email(user.email)
+ request_company.parent_name = business_name
+ # if user.parent_id:
+ # request_company.send_company_switch_approve_mail()
+ # else:
+ # request_company.send_company_request_mail_switch()
+
+ request_company.send_company_request_mail_switch()
response['switch'] = 'Pending'
return self.response(response)
@@ -556,7 +669,7 @@ class User(controller.Controller):
# @controller.Controller.must_authorized()
def switch_account_progres(self, **kw):
id = int(kw.get('id'))
- user = request.env['res.users'].search([('id', '=', id)], limit=1)
+ # user = request.env['res.partner'].search([('id', '=', id)], limit=1)
response = {
'status': ''
}
@@ -572,5 +685,122 @@ class User(controller.Controller):
else:
response['status'] = new_company_request.is_approve
else:
- response['status'] = 'unknown'
+ response['status'] = False
+ return self.response(response)
+
+ def get_user_by_email(self, email):
+ return request.env['res.users'].search([
+ ('login', '=', email),
+ ('active', 'in', [True, False])
+ ])
+
+ @http.route(prefix + 'user/download/npwp/<id>', auth='public', methods=['GET'])
+ def download_npwp(self, **kw):
+ id = int(kw.get('id'))
+ """Download NPWP file for the given company"""
+ # Search for the NPWP attachment associated with the company
+ attachment = request.env['ir.attachment'].search([
+ ('res_model', '=', 'res.partner'),
+ ('res_id', '=', id),
+ ('name', '=', 'NPWP Document')
+ ], limit=1)
+
+ if not attachment:
+ return request.not_found()
+
+ # Get the file data and content type
+ npwp_mimetype = attachment.mimetype # This should be directly from the attachment
+ npwp_mimetype = npwp_mimetype or 'application/octet-stream'
+
+ # Create a filename with the correct extension
+ filename = f"{attachment.name}"
+
+ # Manually set the Content-Disposition header to inline
+ content_disposition = f'inline; filename="{filename}"'
+
+ # Send the file as a response
+ return request.make_response(
+ base64.b64decode(attachment.datas),
+ headers=[
+ ('Content-Type', npwp_mimetype),
+ ('Content-Disposition', content_disposition)
+ ]
+ )
+
+ @http.route(prefix + 'user/chek/npwp/<id>', auth='public', methods=['GET', 'OPTIONS'])
+ @controller.Controller.must_authorized()
+ def chek_npwp(self, **kw):
+ id = int(kw.get('id'))
+ """Download NPWP file for the given company"""
+ # Search for the NPWP attachment associated with the company
+ attachment = request.env['ir.attachment'].search([
+ ('res_model', '=', 'res.partner'),
+ ('res_id', '=', id),
+ ('name', '=', 'NPWP Document')
+ ], limit=1)
+ response = {
+ 'status': ''
+ }
+ if attachment:
+ response['status'] = True
+ else:
+ response['status'] = False
+
+ # If no attachment is found, return status False
+ return self.response(response)
+
+ @http.route(prefix + 'user/download/sppkp/<id>', auth='public', methods=['GET'])
+ def download_sppkp(self, **kw):
+ id = int(kw.get('id'))
+ """Download SPPKP file for the given company"""
+ # Search for the SPPKP attachment associated with the company
+ attachment = request.env['ir.attachment'].search([
+ ('res_model', '=', 'res.partner'),
+ ('res_id', '=', id),
+ ('name', '=', 'SPPKP Document')
+ ], limit=1)
+
+ if not attachment:
+ return request.not_found()
+
+ # Get the file data and content type
+ sppkp_mimetype = attachment.mimetype # Use the MIME type directly from the attachment
+ sppkp_mimetype = sppkp_mimetype or 'application/octet-stream'
+
+ # Create a filename with the correct extension
+ filename = attachment.name # No need to append extension since attachment should already have it
+
+ # Manually set the Content-Disposition header to inline
+ content_disposition = f'inline; filename="{filename}"'
+
+ # Send the file as a response
+ return request.make_response(
+ base64.b64decode(attachment.datas),
+ headers=[
+ ('Content-Type', sppkp_mimetype),
+ ('Content-Disposition', content_disposition) # Ensure inline display
+ ]
+ )
+
+ @http.route(prefix + 'user/chek/sppkp/<id>', auth='public', methods=['GET', 'OPTIONS'])
+ @controller.Controller.must_authorized()
+ def chek_sppkp(self, **kw):
+ id = int(kw.get('id'))
+ """Download SPPKP file for the given company"""
+ # Search for the SPPKP attachment associated with the company
+ attachment = request.env['ir.attachment'].search([
+ ('res_model', '=', 'res.partner'),
+ ('res_id', '=', id),
+ ('name', '=', 'SPPKP Document')
+ ], limit=1)
+
+ response = {
+ 'status': ''
+ }
+ if attachment:
+ response['status'] = True
+ else:
+ response['status'] = False
+
+ # If no attachment is found, return status False
return self.response(response) \ No newline at end of file
diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py
index 2021b0bb..015b9e0e 100644
--- a/indoteknik_api/models/res_users.py
+++ b/indoteknik_api/models/res_users.py
@@ -63,13 +63,15 @@ class ResUsers(models.Model):
'district': None,
'sub_district': None,
'zip': user.zip or '',
- 'company_type_id': user.company_type_id.id or None,
- 'industry_id': user.industry_id.id or None,
+ 'company_type_id': user.company_type_id.id or '',
+ 'industry_id': user.industry_id.id or '',
'tax_name': user.nama_wajib_pajak or '',
'npwp': user.npwp or '',
+ 'sppkp': user.sppkp or '',
'rajaongkir_city_id': user.kecamatan_id.rajaongkir_id or 0,
- 'alamat_wajib_pajak': user.alamat_lengkap_text or None,
- 'alamat_bisnis': user.street or None,
+ 'alamat_wajib_pajak': user.alamat_lengkap_text or '',
+ 'alamat_bisnis': user.street or '',
+ 'company_type': user.customer_type or 'nonpkp',
'longtitude': user.longtitude or None,
'latitude': user.latitude or None,
'address_map': user.address_map or None,
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
diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml
index d7a6b2dd..9553bb91 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" &lt;noreply@indoteknik.com&gt;</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;">
@@ -45,6 +45,11 @@
<tr><td style="padding-bottom: 2px;">Hormat kami,</td></tr>
<tr><td style="padding-bottom: 2px;">PT. Indoteknik Dotcom Gemilang</td></tr>
<tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
<td style="text-align:center;">
<hr width="100%"
style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
@@ -65,7 +70,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" &lt;noreply@indoteknik.com&gt;</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;">
@@ -105,6 +110,76 @@
<tr><td style="padding-bottom: 2px;"><strong>Hormat kami,</strong></td></tr>
<tr><td style="padding-bottom: 2px;">Indoteknik.com</td></tr>
<tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:center;">
+ <hr width="100%"
+ style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ </tbody>
+ </table>
+ </td></tr>
+ </table>
+ </field>
+ </record>
+ <record id="mail_template_res_user_company_request_switch" model="mail.template">
+ <field name="name">Users: Company Request</field>
+ <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" &lt;noreply@indoteknik.com&gt;</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;">
+ <tr><td align="center">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
+ <!-- HEADER -->
+ <tbody>
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr>
+ <td valign="middle">
+ <span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" style="text-align:center;">
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr><td style="padding-bottom: 24px;"><b>Halo ${object.name},</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas kepercayaan Anda dengan mendaftarkan bisnis Anda di Indoteknik.com. Permohonan Anda saat ini sedang dalam proses review oleh tim kami.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Saat ini, kami sedang melakukan pengecekan akhir pada data yang Anda berikan. Proses ini biasanya memakan waktu sekitar 2 x 24 jam.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Setelah proses review selesai, kami akan segera menginformasikan status akun bisnis Anda melalui email.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Jika ada pertanyaan lebih lanjut, jangan ragu untuk menghubungi kami di <a href="mailto:sales@indoteknik.com">sales@indoteknik.com</a> atau hubungi whatsapp kami di <a href="https://wa.me/6281717181922">0817-1718-1922</a></td></tr>
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas perhatiannya.</td></tr>
+
+ <tr><td style="padding-bottom: 2px;"><strong>Hormat kami,</strong></td></tr>
+ <tr><td style="padding-bottom: 2px;">Indoteknik.com</td></tr>
+ <tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
<td style="text-align:center;">
<hr width="100%"
style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
@@ -125,7 +200,7 @@
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">Email Pendaftaran Bisnis Berhasil</field>
<field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</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;">
@@ -166,6 +241,74 @@
<tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
<tr><td style="padding-bottom: 2px;">Indoteknik.com</td></tr>
<tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:center;">
+ <hr width="100%"
+ style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ </tbody>
+ </table>
+ </td></tr>
+ </table>
+ </field>
+ </record>
+ <record id="mail_template_res_user_company_switch_approve" model="mail.template">
+ <field name="name">Users: Switch Account Success</field>
+ <field name="model_id" ref="base.model_res_users"/>
+ <field name="subject">Selamat! Bisnis Anda Sudah Naik Kelas Jadi PKP!</field>
+ <field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</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;">
+ <tr><td align="center">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
+ <!-- HEADER -->
+ <tbody>
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr>
+ <td valign="middle">
+ <span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" style="text-align:center;">
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr><td style="padding-bottom: 24px;"><b>Hai ${object.parent_name},</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Selamat! Akun bisnis Anda di indoteknik.com sekarang sudah resmi menjadi PKP dari yang sebelumnya Non-PKP.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Jangan lupa untuk mengecek kembali semua data perusahaan kamu, ya. Pastikan NPWP dan informasi Perusahaan lainnya sudah kamu isi dengan benar.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Kamu juga dapat mengubah informasi perusahaan dengan mengunjungi profil atau <a href="https://indoteknik.com/my/profile">klik disini</a></td></tr>
+
+ <tr><td style="padding-bottom: 2px;">Industrial Supply &amp; Solutions</td></tr>
+ <tr><td style="padding-bottom: 2px;">Tim Indoteknik.com</td></tr>
+ <tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
<td style="text-align:center;">
<hr width="100%"
style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
@@ -186,7 +329,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" &lt;noreply@indoteknik.com&gt;</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;">
@@ -239,6 +382,11 @@
<tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
<tr><td style="padding-bottom: 2px;">Indoteknik.com</td></tr>
<tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
<td style="text-align:center;">
<hr width="100%"
style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
diff --git a/indoteknik_custom/views/user_company_request.xml b/indoteknik_custom/views/user_company_request.xml
index 6d5642e6..88d04c64 100644
--- a/indoteknik_custom/views/user_company_request.xml
+++ b/indoteknik_custom/views/user_company_request.xml
@@ -8,7 +8,7 @@
<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'"
@@ -33,8 +33,8 @@
<field name="similar_company_ids" invisible="1"/>
<field name="user_company_id" domain="[('id', 'in', similar_company_ids)]"/>
<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'"