summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order.py
diff options
context:
space:
mode:
authorHafidBuroiroh <hafidburoiroh09@gmail.com>2025-09-25 16:11:07 +0700
committerHafidBuroiroh <hafidburoiroh09@gmail.com>2025-09-25 16:11:07 +0700
commit7fed48782b6790be66cf8134eacc36881eeb29d4 (patch)
tree3b83b6ac5fe6867a37942a7875f8a9dd5aa3d48b /indoteknik_custom/models/sale_order.py
parent07502e1f93e166abea766c8b4b50ed2e94639df8 (diff)
<hafid> refund
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
-rwxr-xr-xindoteknik_custom/models/sale_order.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 39830ffc..36dcbb4e 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -3278,10 +3278,17 @@ class SaleOrder(models.Model):
('state', '=', 'posted'),
])
+ moves2 = self.env['account.move'].search([
+ ('ref', 'ilike', self.name),
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ])
+
# Default 0
total_uang_muka = 0.0
has_moves = bool(moves)
+ has_moves2 = bool(moves2)
has_piutangmdr = bool(piutangmdr)
has_piutangbca = bool(piutangbca)
has_settlement = self.payment_status == 'settlement'
@@ -3290,6 +3297,8 @@ class SaleOrder(models.Model):
total_uang_muka = sum(moves.mapped('amount_total_signed')) + self.gross_amount
elif has_moves:
total_uang_muka = sum(moves.mapped('amount_total_signed'))
+ elif has_moves2:
+ total_uang_muka = sum(moves2.mapped('amount_total_signed'))
elif has_settlement:
total_uang_muka = self.gross_amount
elif has_piutangbca:
@@ -3377,12 +3386,20 @@ class SaleOrder(models.Model):
('state', '=', 'posted'),
])
+ moves2 = self.env['account.move'].search([
+ ('ref', 'ilike', order.name),
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ])
+
total_uang_muka = 0.0
if moves and order.payment_status == 'settlement':
total_uang_muka = order.gross_amount + sum(moves.mapped('amount_total_signed')) or 0.0
elif moves:
total_uang_muka = sum(moves.mapped('amount_total_signed')) or 0.0
+ elif moves2:
+ total_uang_muka = sum(moves2.mapped('amount_total_signed')) or 0.0
elif order.payment_status == 'settlement':
total_uang_muka = order.gross_amount
else: