diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-04 09:26:26 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-04 09:26:26 +0700 |
| commit | c1bde5a538b04186a5c83aea2817cd4f05f2acd7 (patch) | |
| tree | 55f1f58ced10736d349742f0a9838e2d56f59e34 | |
| parent | 1991342a572fd6a3a4f9b2c988db939748125e4c (diff) | |
<miqdad> fix orig id and dest id
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index eeec2d80..db82ce1b 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -371,21 +371,29 @@ class TukarGuling(models.Model): # Determine locations based on picking type if picking.picking_type_id.id == 30: + # BU/PICK → ORT 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 == 74: + # ORT → BU/PICK + return_type = bu_pick_type + default_location_id = BU_STOCK_LOCATION_ID + default_location_dest_id = BU_OUTPUT_LOCATION_ID + elif picking.picking_type_id.id == 29: + # BU/OUT → SRT 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: + + elif picking.picking_type_id.id == 73: + # SRT → BU/OUT return_type = bu_out_type default_location_id = BU_OUTPUT_LOCATION_ID default_location_dest_id = PARTNER_LOCATION_ID - elif picking.picking_type_id.id == 73: - return_type = bu_pick_type - default_location_id = BU_STOCK_LOCATION_ID - default_location_dest_id = BU_OUTPUT_LOCATION_ID + else: return None return_context = dict(self.env.context) @@ -456,16 +464,16 @@ class TukarGuling(models.Model): created_returns.append(ort) if record.return_type == 'tukar_guling': - if srt: - bu_out = _create_return_from_picking(srt) - if bu_out: - created_returns.append(bu_out) - if ort: bu_pick = _create_return_from_picking(ort) if bu_pick: created_returns.append(bu_pick) + if srt: + bu_out = _create_return_from_picking(srt) + if bu_out: + created_returns.append(bu_out) + if not created_returns: raise UserError("wkwkwk") |
