diff options
| -rw-r--r-- | indoteknik_custom/models/refund_sale_order.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 9eae5b32..bbab3ec4 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -326,8 +326,23 @@ class RefundSaleOrder(models.Model): domain.append(('ref', 'ilike', n)) moves2 = self.env['account.move'].search(domain) + moves3 = self.env['account.move'] + if so_ids: + so_names = self.env['sale.order'].browse(so_ids).mapped('name') + domain = [ + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ('ref', 'ilike', 'uang muka penjualan') + ] + if so_names: + domain += ['|'] * (len(so_names) - 1) + for n in so_names: + domain.append(('ref', 'ilike', n)) + moves3 = self.env['account.move'].search(domain) + has_moves = bool(moves) has_moves2 = bool(moves2) + has_moves3 = bool(moves3) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) has_misc = bool(misc) @@ -349,6 +364,8 @@ class RefundSaleOrder(models.Model): # sisanya bisa dijumlahkan tanpa konflik if has_moves2: amounts.append(sum(moves2.mapped('amount_total_signed'))) + if has_moves3: + amounts.append(sum(moves3.mapped('amount_total_signed'))) if has_piutangbca: amounts.append(sum(piutangbca.mapped('amount_total_signed'))) if has_piutangmdr: @@ -573,9 +590,10 @@ class RefundSaleOrder(models.Model): domain = [ ('journal_id', '=', 11), ('state', '=', 'posted'), - '|', + '|', '|', ('ref', 'ilike', 'dp'), ('ref', 'ilike', 'payment'), + ('ref', 'ilike', 'uang muka penjualan'), ] domain += ['|'] * (len(so_names) - 1) for n in so_names: @@ -653,6 +671,7 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 13), ('state', '=', 'posted'), ]) + moves2 = self.env['account.move'] if so_ids: so_records = self.env['sale.order'].browse(so_ids) @@ -668,9 +687,26 @@ class RefundSaleOrder(models.Model): domain.append(('ref', 'ilike', n)) moves2 = self.env['account.move'].search(domain) + + moves3 = self.env['account.move'] + if so_ids: + so_records = self.env['sale.order'].browse(so_ids) + so_names = so_records.mapped('name') + + domain = [ + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ('ref', 'ilike', 'uang muka penjualan') + ] + domain += ['|'] * (len(so_names) - 1) + for n in so_names: + domain.append(('ref', 'ilike', n)) + + moves3 = self.env['account.move'].search(domain) has_moves = bool(moves) has_moves2 = bool(moves2) + has_moves3 = bool(moves3) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) has_misc = bool(misc) @@ -685,6 +721,8 @@ class RefundSaleOrder(models.Model): amounts.append(sum(moves.mapped('amount_total_signed'))) if has_moves2: amounts.append(sum(moves2.mapped('amount_total_signed'))) + if has_moves3: + amounts.append(sum(moves3.mapped('amount_total_signed'))) if has_piutangbca: amounts.append(sum(piutangbca.mapped('amount_total_signed'))) if has_piutangmdr: |
