diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-04 14:38:58 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-04 14:38:58 +0700 |
| commit | d2a64b4e6023f0768d5c326c833fd5a9d8a11444 (patch) | |
| tree | 98149f6da42a924b7ad1a1b01c50feeaa138a0bb /indoteknik_custom/models/sale_order.py | |
| parent | 8bb3696e35dc122ea153566834a48ec0659e0101 (diff) | |
| parent | fb9b47c3fb5773782f84628764a01c5deb9be035 (diff) | |
Merge branch 'odoo-backup' of bitbucket.org:altafixco/indoteknik-addons into cr_renca_find
merge
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 17691798..a4bc2309 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2305,7 +2305,7 @@ class SaleOrder(models.Model): search_bom = self.env['mrp.production'].search([('product_id', '=', line.product_id.id), ('sale_order', '=', order.id), ('state', '!=', 'cancel')], order='name desc') if search_bom: - confirmed_bom = search_bom.filtered(lambda x: x.state == 'confirmed' or x.state == 'done') + confirmed_bom = search_bom.filtered(lambda x: x.state in ['confirmed', 'to_close', 'progress', 'done']) if not confirmed_bom: raise UserError( "Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi Purchasing.") @@ -3438,7 +3438,7 @@ class SaleOrder(models.Model): def button_refund(self): self.ensure_one() - invoice_ids = self.invoice_ids.filtered(lambda inv: inv.state != 'cancel') + invoice_ids = self.invoice_ids.filtered(lambda inv: inv.state == 'posted') moves = self.env['account.move'].search([ ('sale_id', '=', self.id), @@ -3447,6 +3447,7 @@ class SaleOrder(models.Model): ]) piutangbca = self.env['account.move'] piutangmdr = self.env['account.move'] + cabinvoice = self.env['account.move'] for inv_name in invoice_ids.mapped('name'): piutangbca |= self.env['account.move'].search([ @@ -3459,6 +3460,11 @@ class SaleOrder(models.Model): ('journal_id', '=', 7), ('state', '=', 'posted'), ]) + cabinvoice |= self.env['account.move'].search([ + ('ref', 'ilike', inv_name), + ('journal_id', '=', 11), + ('state', '=', 'posted'), + ]) moves2 = self.env['account.move'].search([ ('ref', 'ilike', self.name), @@ -3473,6 +3479,7 @@ class SaleOrder(models.Model): has_moves2 = bool(moves2) has_piutangmdr = bool(piutangmdr) has_piutangbca = bool(piutangbca) + has_cabinvoice = bool(cabinvoice) has_settlement = self.payment_status == 'settlement' if has_moves and has_settlement: @@ -3483,6 +3490,8 @@ class SaleOrder(models.Model): total_uang_muka = sum(moves2.mapped('amount_total_signed')) elif has_settlement: total_uang_muka = self.gross_amount + elif has_cabinvoice: + total_uang_muka = sum(cabinvoice.mapped('amount_total_signed')) elif has_piutangbca: total_uang_muka = sum(piutangbca.mapped('amount_total_signed')) elif has_piutangmdr: |
