From 1be3cacacce54b6fe71eb3786d152c1d18707724 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 21 Jun 2025 16:07:48 +0700 Subject: re fix location --- indoteknik_custom/models/tukar_guling.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index da1cfcf4..5c99bc18 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -337,17 +337,17 @@ class TukarGuling(models.Model): def _create_return_from_picking(picking): grup = self.operations.group_id - PARTNER_LOCATION_ID = 5 # Partner Locations/Customers - BU_OUTPUT_LOCATION_ID = 60 # BU/Output (from your logs) - BU_STOCK_LOCATION_ID = 57 # BU/Stock (adjust to your actual ID) + PARTNER_LOCATION_ID = 5 + BU_OUTPUT_LOCATION_ID = 60 + BU_STOCK_LOCATION_ID = 57 # Determine locations based on picking type - if picking.picking_type_id.id == 29: # BU/OUT → BU/SRT - default_location_id = PARTNER_LOCATION_ID # From: Partner Locations - default_location_dest_id = BU_OUTPUT_LOCATION_ID # To: BU/Output - elif picking.picking_type_id.id == 30: # BU/PICK → BU/ORT - default_location_id = BU_OUTPUT_LOCATION_ID # From: BU/Output - default_location_dest_id = BU_STOCK_LOCATION_ID # To: BU/Stock (FIXED) + if picking.picking_type_id.id == 29: + default_location_id = PARTNER_LOCATION_ID + default_location_dest_id = BU_OUTPUT_LOCATION_ID + elif picking.picking_type_id.id == 30: + default_location_id = BU_OUTPUT_LOCATION_ID + default_location_dest_id = BU_STOCK_LOCATION_ID else: return None @@ -389,7 +389,7 @@ class TukarGuling(models.Model): if not return_picking: raise UserError("Retur gagal dibuat. Hasil create_returns: %s" % str(return_vals)) - # Force the destination location (extra safeguard) + # Force the destination location return_picking.write({ 'location_dest_id': default_location_dest_id, 'group_id': grup.id, -- cgit v1.2.3