diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-30 13:56:43 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-30 13:56:43 +0700 |
| commit | 90a29846ae6008b3152d495f2e83a5d00cfdd438 (patch) | |
| tree | 8feb45b6907c7e83cf2b60b6b25618e4a9ae1791 /indoteknik_api/controllers/api_v1/user.py | |
| parent | c2c2ef9cadd3e6cca40a9b2825cdb29c5c77d466 (diff) | |
<iman> update switch account
Diffstat (limited to 'indoteknik_api/controllers/api_v1/user.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/user.py | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 4a01f88b..a4655417 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -450,12 +450,24 @@ class User(controller.Controller): 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 - }) + if user.parent_id : + match_company.email = email_partner, + match_company.customer_type = 'pkp' if is_pkp == 'true' else 'nonpkp', + match_company.name = business_name if business_name else business_name, + match_company.company_type_id.id = company_type_id if company_type_id else False, + match_company.industry_id.id = industry_id, + match_company.npwp = npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'), + match_company.sppkp = sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'), + match_company.nama_wajib_pajak = nama_wajib_pajak, + match_company.alamat_lengkap_text = alamat_wajib_pajak, + match_company.street = alamat_bisnis, + else: + # 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 @@ -505,7 +517,10 @@ class User(controller.Controller): 'res_id': new_company.id, 'mimetype': npwp_mimetype }) - new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id]) + 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) @@ -519,7 +534,10 @@ class User(controller.Controller): 'res_id': new_company.id, 'mimetype': sppkp_mimetype }) - new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id]) + 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 request_company.send_company_request_mail() |
