summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-03-20 10:16:37 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-03-20 10:16:37 +0700
commitc48f3204c84cf7fca8da827178c4971370b324f8 (patch)
treecaef3282b4d53fb1b7cdd9c03b4fd3e4fb59dda0
parentcc1759574f76b084a1ce44e1acf01ed20dcdd729 (diff)
<iman> update logic duplicatee contact
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_request.py15
1 files changed, 1 insertions, 14 deletions
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py
index abcb6f2f..caa420e5 100644
--- a/indoteknik_custom/models/user_pengajuan_tempo_request.py
+++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py
@@ -548,20 +548,7 @@ class UserPengajuanTempoRequest(models.Model):
('name', '=', contact_data['name'])
], limit=1)
- if existing_contact:
- # Pastikan tidak ada duplikasi nama dalam perusahaan yang sama
- duplicate_check = self.env['res.partner'].search([
- ('name', '=', contact_data['name']),
- ('id', '!=', existing_contact.id) # Hindari update yang menyebabkan duplikasi global
- ], limit=1)
-
- if not duplicate_check:
- # Perbarui hanya field yang tidak menyebabkan konflik
- update_data = {k: v for k, v in contact_data.items() if k != 'name'}
- existing_contact.write(update_data)
- else:
- raise UserError(f"Skipping update for {contact_data['name']} due to existing duplicate.")
- else:
+ if not existing_contact:
# Pastikan tidak ada partner lain dengan nama yang sama sebelum membuat baru
duplicate_check = self.env['res.partner'].search([
('name', '=', contact_data['name'])