summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
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
parent5f4f209e9f04dfc196ef7a8cbc765fad219b15bd (diff)
parentcd10b3dece04b57bce454ba652dc1bb7662d6456 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/coretax_fatur.py10
-rw-r--r--indoteknik_custom/models/stock_picking_return.py15
-rw-r--r--indoteknik_custom/models/tukar_guling.py20
3 files changed, 30 insertions, 15 deletions
diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py
index cabcd5d6..755c5cc3 100644
--- a/indoteknik_custom/models/coretax_fatur.py
+++ b/indoteknik_custom/models/coretax_fatur.py
@@ -147,7 +147,15 @@ class CoretaxFaktur(models.Model):
subtotal = line_price_subtotal
quantity = line_quantity
total_discount = round(line_discount, 2)
- coretax_id = line.product_uom_id.coretax_id
+ if isinstance(line, dict):
+ product = line.get('product_id')
+ uom = product.uom_id if product else False
+ else:
+ uom = line.product_uom_id
+
+ coretax_id = uom.coretax_id if uom else ''
+
+ # coretax_id = line.product_uom_id.coretax_id
# Calculate other tax values
otherTaxBase = round(subtotal * (11 / 12), 2) if subtotal else 0
vat_amount = round(otherTaxBase * 0.12, 2)
diff --git a/indoteknik_custom/models/stock_picking_return.py b/indoteknik_custom/models/stock_picking_return.py
index 53a85f67..9cf017f9 100644
--- a/indoteknik_custom/models/stock_picking_return.py
+++ b/indoteknik_custom/models/stock_picking_return.py
@@ -120,8 +120,19 @@ class ReturnPicking(models.TransientModel):
'target': 'current',
'context': context,
}
- if picking.sale_id or 'SO' in (picking.origin or ''):
- _logger.info("This picking is NOT from a PO, fallback to SO.")
+ # if picking.sale_id or 'SO' in (picking.origin or ''):
+ # _logger.info("This picking is NOT from a PO, fallback to SO.")
+ # return {
+ # 'name': _('Tukar Guling SO'),
+ # 'type': 'ir.actions.act_window',
+ # 'res_model': 'tukar.guling',
+ # 'view_mode': 'form',
+ # 'target': 'current',
+ # 'context': context,
+ # }
+
+ if picking.name and any(k in picking.name.upper() for k in ('PICK', 'OUT')):
+ _logger.info("Redirect ke Tukar Guling SO via sale_id / origin")
return {
'name': _('Tukar Guling SO'),
'type': 'ir.actions.act_window',
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: