diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-10 14:00:00 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-10 14:00:00 +0700 |
| commit | d89f6b21f0174d52b1efb7d54ec3443bbbe3fbcb (patch) | |
| tree | 9954a125c16f4d1379a25162a4addd2f2b1613f7 /indoteknik_custom/models | |
| parent | c827294ee6dd613de089af846521cfdc76550e16 (diff) | |
(andri) penyesuaian munculnya field
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/invoice_reklas.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py index b7d52371..5145e098 100644 --- a/indoteknik_custom/models/invoice_reklas.py +++ b/indoteknik_custom/models/invoice_reklas.py @@ -27,6 +27,7 @@ class InvoiceReklas(models.TransientModel): move = self.env['account.move'].browse(active_ids[0]) cab = False + # Deteksi dari mana asal CAB if move.move_type == 'entry': cab = move elif move.move_type == 'in_invoice': @@ -35,12 +36,14 @@ class InvoiceReklas(models.TransientModel): elif move.purchase_order_id and move.purchase_order_id.move_id: cab = move.purchase_order_id.move_id + # Isi field Nomor CAB jika ditemukan if cab: self.reklas_id = cab.id - # ✅ Selalu ambil nilai dari invoice yang direklas (bukan dari CAB) + # Nilai yang dibayarkan harus tetap ambil dari invoice/bill self.pay_amt = move.amount_total + @api.model def default_get(self, fields): res = super().default_get(fields) @@ -64,11 +67,11 @@ class InvoiceReklas(models.TransientModel): return res - @api.onchange('reklas_type') - def _onchange_reklas_type(self): - if self.reklas_type == 'penjualan': - invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) - self.pay_amt = invoices.amount_total + # @api.onchange('reklas_type') + # def _onchange_reklas_type(self): + # if self.reklas_type == 'penjualan': + # invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) + # self.pay_amt = invoices.amount_total def create_reklas(self): if not self.reklas_type: |
