diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-22 21:09:36 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-22 21:09:36 +0700 |
| commit | 39e570854fa72d673bd37fc6582861bf1fc49aa7 (patch) | |
| tree | 1793866bbadf4bfa5ceec6b2a4509d346e9561ff | |
| parent | 4430c79a3388c591725cdbd12e32c6c371b6ecd3 (diff) | |
<miqdad> should be done
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index a7b6e07e..456a2111 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -303,7 +303,7 @@ class TukarGuling(models.Model): raise UserError( "Tidak ditemukan BU/PICK atau BU/OUT dari SO: %s" % record.origin) - # 2. Filter berdasarkan tipe picking + # filter based on stockin.picking picking type bu_pick_to_return = related_pickings.filtered(lambda ktl: ktl.picking_type_id.id == 30) # BU/PICK bu_out_to_return = related_pickings.filtered(lambda ktl: ktl.picking_type_id.id == 29) # BU/OUT @@ -345,11 +345,11 @@ class TukarGuling(models.Model): # Determine locations based on picking type if picking.picking_type_id.id == 30: # -> ngeretur bu pick - return_type = srt_type + return_type = ort_type default_location_id = BU_OUTPUT_LOCATION_ID default_location_dest_id = BU_STOCK_LOCATION_ID elif picking.picking_type_id.id == 29: # -> ngeretur bu out - return_type = ort_type + return_type = srt_type default_location_id = PARTNER_LOCATION_ID default_location_dest_id = BU_OUTPUT_LOCATION_ID elif picking.picking_type_id.id == 74: # -> ngeretur srt @@ -373,7 +373,8 @@ class TukarGuling(models.Model): return_wizard = self.env['stock.return.picking'].with_context(return_context).create({ 'picking_id': picking.id, - 'location_id': default_location_id, + 'location_id': default_location_dest_id, + 'original_location_id': default_location_id }) # Create return lines @@ -404,6 +405,7 @@ class TukarGuling(models.Model): # Force the destination location return_picking.write({ 'location_dest_id': default_location_dest_id, + 'location_id': default_location_id, 'group_id': grup.id, 'tukar_guling_id': record.id, }) @@ -422,9 +424,9 @@ class TukarGuling(models.Model): if name: created_returns.append(name) - # Buat return dari SRT + # Buat return dari SRT dan ort if record.return_type == 'tukar_guling': - target = [woi for woi in created_returns if woi.picking_type_id.id in (73, 74)] + target = [woi for woi in created_returns if woi.picking_type_id.id in (74, 73)] for picking in target: retur = _create_return_from_picking(picking) if retur: |
