summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/tukar_guling.py
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2025-11-25 08:59:41 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2025-11-25 08:59:41 +0700
commit1e10f5149dcd753018b919aa9fac5e54c81a533c (patch)
tree4e561a147c6250b7d4eb41bb8bce500eee0014bd /indoteknik_custom/models/tukar_guling.py
parentbb2be920076aabc49b4f9fdd896d14e096e633eb (diff)
parent61aabd2a7be015a19d9a16d8e160f5a3c3c6efaf (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into locator_mqddlocator_mqdd
merge
Diffstat (limited to 'indoteknik_custom/models/tukar_guling.py')
-rw-r--r--indoteknik_custom/models/tukar_guling.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py
index aa116ce3..99a74505 100644
--- a/indoteknik_custom/models/tukar_guling.py
+++ b/indoteknik_custom/models/tukar_guling.py
@@ -737,18 +737,14 @@ class TukarGuling(models.Model):
if mapping_koli and record.operations.picking_type_id.id == 29:
for prod in mapping_koli.mapped('product_id'):
qty_total = sum(mk.qty_return for mk in mapping_koli.filtered(lambda m: m.product_id == prod))
-
- move_lines = bu_out.move_line_ids.filtered(
- lambda ml: ml.product_id == prod and ml.qty_done > 0 and not ml.package_id
- )
-
- for ml in move_lines:
- srt_return_lines.append((0, 0, {
- 'product_id': ml.product_id.id,
- 'quantity': ml.qty_done,
- 'move_id': ml.move_id.id,
- }))
-
+ move = bu_out.move_lines.filtered(lambda m: m.product_id == prod)
+ if not move:
+ raise UserError(f"Move BU/OUT tidak ditemukan untuk produk {prod.display_name}")
+ srt_return_lines.append((0, 0, {
+ 'product_id': prod.id,
+ 'quantity': qty_total,
+ 'move_id': move.id,
+ }))
_logger.info(f"📟 SRT line: {prod.display_name} | qty={qty_total}")
elif not mapping_koli and record.operations.picking_type_id.id == 29: