summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/tukar_guling.py
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-11-24 13:35:20 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-11-24 13:35:20 +0700
commit25f4403de98f1494fb1d5952e9eb32bfe3bf061d (patch)
tree8d295123e693fcaf92ef4f2e67a858a8c0a5f0cb /indoteknik_custom/models/tukar_guling.py
parent5f4f209e9f04dfc196ef7a8cbc765fad219b15bd (diff)
parentcd10b3dece04b57bce454ba652dc1bb7662d6456 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
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: