summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-09-25 09:12:52 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-09-25 09:12:52 +0000
commit0d9b4feda638e606db3c5fe2c6b3ba8cbcb2f4d4 (patch)
treef42778834ec043b92e6dc84c1b2bf9b16862c6cc /indoteknik_custom/models/sale_order.py
parent1299851d0d6280d92ccc4123a82ea083a92bc7ec (diff)
parent7fed48782b6790be66cf8134eacc36881eeb29d4 (diff)
Merged in refund_system (pull request #436)
<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 f80941d2..663cba58 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -3340,10 +3340,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'
@@ -3352,6 +3359,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:
@@ -3439,12 +3448,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: