From d89f6b21f0174d52b1efb7d54ec3443bbbe3fbcb Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 10 Jun 2025 14:00:00 +0700 Subject: (andri) penyesuaian munculnya field --- indoteknik_custom/models/invoice_reklas.py | 15 +++++++++------ indoteknik_custom/views/account_move.xml | 4 ++-- 2 files changed, 11 insertions(+), 8 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: diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 3a620a6a..0c2f9a68 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -37,8 +37,8 @@ - - + + -- cgit v1.2.3