summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1/partner.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-12-04 10:58:46 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-12-04 10:58:46 +0700
commit0aad5455df5d36ef87ab1cbd52030a3cf0bef1d8 (patch)
tree836b3fe58aaf78cc2a6980ee669c332e0bd81ce4 /indoteknik_api/controllers/api_v1/partner.py
parent585ce08efde0f61ba6462b8e303cb08615f0cf33 (diff)
<iman> update code pengajuan tempo
Diffstat (limited to 'indoteknik_api/controllers/api_v1/partner.py')
-rw-r--r--indoteknik_api/controllers/api_v1/partner.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py
index 19c73aec..0522e8e1 100644
--- a/indoteknik_api/controllers/api_v1/partner.py
+++ b/indoteknik_api/controllers/api_v1/partner.py
@@ -284,10 +284,10 @@ class Partner(controller.Controller):
user_id = int(kw.get('user_id'))
tempo_request = True if kw.get('tempo_request') == 'true' else False
pengajuan_tempo = request.env['user.pengajuan.tempo'].search([('name_tempo', '=', user_id)], limit=1)
- user = request.env['res.partner'].search([('id', '=', id)], limit=1)
+ user = request.env['res.partner'].search([('id', '=', user_id)], limit=1)
company_name = kw.get('name', pengajuan_tempo.name_tempo.name)
partner_id = request.env['res.partner'].search([('name', 'like', company_name)], limit=1)
- user_account = self.get_user_by_email(user.user_id.email)
+ user_account = self.get_user_by_email(user.email)
params = self.get_request_params(kw, {
@@ -374,7 +374,7 @@ class Partner(controller.Controller):
supplier_ids_to_add.append(new_supplier_data.id)
- pengajuan_tempo.write({'supplier_ids': [(4, supplier_id, 0) for supplier_id in supplier_ids_to_add]})
+ pengajuan_tempo.write({'supplier_ids': [(6, 0, supplier_ids_to_add)]})
except json.JSONDecodeError:
return http.Response(status=400, json_body={'error': 'Invalid JSON format for formSupplier'})
@@ -477,31 +477,31 @@ class Partner(controller.Controller):
'mimetype': mimetype
})
- if dokumen['documentName'] == 'dokumenNib' and dokumen['details']['base64'] != '':
+ if dokumen['documentName'] == 'dokumenNib' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_nib = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenNpwp' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenNpwp' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_npwp = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenSppkp' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenSppkp' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_sppkp = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenAktaPerubahan' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenAktaPerubahan' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_akta_perubahan = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenKtpDirut' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenKtpDirut' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_ktp_dirut = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenAktaPendirian' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenAktaPendirian' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_akta_pendirian = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenLaporanKeuangan' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenLaporanKeuangan' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_laporan_keuangan = [(4, sppkp_attachment.id)]
- elif dokumen['documentName'] == 'dokumenFotoKantor' and dokumen['details']['base64'] != '':
+ elif dokumen['documentName'] == 'dokumenFotoKantor' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_foto_kantor = [(4, sppkp_attachment.id)]
- else:
+ elif dokumen['documentName'] == 'dokumen_tempat_bekerja' and dokumen['details']['base64'] != '' :
pengajuan_tempo.dokumen_tempat_bekerja = [(4, sppkp_attachment.id)]
formatted_text = ''.join([' ' + char if char.isupper() and i != 0 else char for i, char in enumerate(dokumen['documentName'])])
@@ -519,9 +519,10 @@ class Partner(controller.Controller):
'tempo_limit': pengajuan_tempo.tempo_limit,
})
pengajuan_tempo.user_id = user_account.id
- template = pengajuan_tempo.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout')
+ template = pengajuan_tempo.env.ref('indoteknik_custom.mail_template_res_user_company_request_tempo_review')
template.send_mail(pengajuan_tempo.id, force_send=True)
- # user_account.send_activation_mail()
+ template2 = pengajuan_tempo.env.ref('indoteknik_custom.mail_template_res_user_company_new_tempo_to_sales')
+ template2.send_mail(pengajuan_tempo.id, force_send=True)
return self.response({
'id': pengajuan_tempo.id,
'user_id': user_id,