diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-21 16:07:48 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-21 16:07:48 +0700 |
| commit | 1be3cacacce54b6fe71eb3786d152c1d18707724 (patch) | |
| tree | 1e6fcae1863c9b31d2618a25091c9979c55dffc2 | |
| parent | ba4b74c9dc301dec73217bb6c35bb78ab7f41fb3 (diff) | |
<miqdad> re fix location
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 20 |
1 files 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, |
