summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-08-28 15:30:24 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-08-28 15:30:24 +0700
commitcf31bebc38f23450b7c429bb4b3a567515071a40 (patch)
tree9f8677736f4f3f2c41186813a3092f5f9eb35895
parent4aa0f2612225de32d361547f39283c1529fe955b (diff)
<iman> update to handle user company request
-rw-r--r--indoteknik_api/controllers/api_v1/user.py8
-rw-r--r--indoteknik_custom/models/user_company_request.py5
2 files changed, 5 insertions, 8 deletions
diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py
index 3fb10333..bbf1c8d1 100644
--- a/indoteknik_api/controllers/api_v1/user.py
+++ b/indoteknik_api/controllers/api_v1/user.py
@@ -167,14 +167,6 @@ class User(controller.Controller):
if match_company:
match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio()
if match_ratio > 0.8:
- # Set the user's partner's parent to the matched company
- user.partner_id.parent_id = match_company.id
- user.partner_id.customer_type = match_company.customer_type
- user.partner_id.npwp = match_company.npwp
- user.partner_id.sppkp = match_company.sppkp
- user.partner_id.nama_wajib_pajak = match_company.nama_wajib_pajak
- user.partner_id.alamat_lengkap_text = match_company.alamat_lengkap_text
-
# Create a user company request
request.env['user.company.request'].create({
'user_id': user.partner_id.id,
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py
index 2467261a..7d28d7ed 100644
--- a/indoteknik_custom/models/user_company_request.py
+++ b/indoteknik_custom/models/user_company_request.py
@@ -22,6 +22,11 @@ class UserCompanyRequest(models.Model):
if not self.is_approve and is_approve:
if is_approve == 'approved':
self.user_id.parent_id = self.user_company_id.id
+ self.user_id.customer_type = self.user_company_id.customer_type
+ self.user_id.npwp = self.user_company_id.npwp
+ self.user_id.sppkp = self.user_company_id.sppkp
+ self.user_id.nama_wajib_pajak = self.user_company_id.nama_wajib_pajak
+ self.user_id.alamat_lengkap_text = self.user_company_id.alamat_lengkap_text
else:
new_company = self.env['res.partner'].create({
'name': self.user_input