summaryrefslogtreecommitdiff
path: root/fixco_custom/models/upload_ginee.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-01-03 14:49:59 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-01-03 14:49:59 +0700
commit821f741178fa5aeba969eda95caf00275fb3c91e (patch)
tree3a4dc25d2e8fd29bed8d06f3a46ac8c0f5df08a2 /fixco_custom/models/upload_ginee.py
parentb7edd32095ea811392ceb11b834c09dadb3be3d4 (diff)
push
Diffstat (limited to 'fixco_custom/models/upload_ginee.py')
-rw-r--r--fixco_custom/models/upload_ginee.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/fixco_custom/models/upload_ginee.py b/fixco_custom/models/upload_ginee.py
index 379a704..d522787 100644
--- a/fixco_custom/models/upload_ginee.py
+++ b/fixco_custom/models/upload_ginee.py
@@ -284,12 +284,21 @@ class UploadGineeLine(models.Model):
else:
# Process single line (non-grouped)
line = lines[0]
+ so_exist = self.env['sale.order'].search(
+ [('invoice_mp', 'ilike', line.invoice_marketplace)]
+ )
+
+ if so_exist:
+ raise UserError(_(
+ "Invoice Marketplace %s sudah terdaftar di Sale Order: %s"
+ ) % (
+ line.invoice_marketplace,
+ ', '.join(so_exist.mapped('name'))
+ ))
+
if not line.order_id:
raise UserError(_('Order ID is empty!'))
- if self.env['sale.order'].search([('invoice_mp', 'ilike', line.invoice_marketplace)]):
- raise UserError(_(
- "Invoice Marketplace %s already exists in Sale Orders") % line.invoice_marketplace)
data = line._call_api(BATCH_GET_URI, {"orderIds": [line.order_id]})
detail_order = self.env['detail.order'].create({
@@ -309,7 +318,6 @@ class UploadGineeLine(models.Model):
line.message_error = str(e)
def get_order_id(self):
-
for rec in self:
try:
if rec.order_id: