From 49dcd6e8111483cd8f64aa2401a41b3a8d57a1dc Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Sat, 7 Jun 2025 13:46:46 +0700 Subject: (andri) onchange Nomor CAB serta nominal terisi otomatis ketika create reklas --- indoteknik_custom/models/invoice_reklas.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py index 8641ca07..59c78ce6 100644 --- a/indoteknik_custom/models/invoice_reklas.py +++ b/indoteknik_custom/models/invoice_reklas.py @@ -18,6 +18,15 @@ class InvoiceReklas(models.TransientModel): ('pembelian', 'Pembelian'), ], string='Reklas Tipe') + @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 + # Tambahan ini: + if len(invoices) == 1 and invoices.move_type == 'entry': + self.reklas_id = invoices.id + @api.model def default_get(self, fields): res = super().default_get(fields) -- cgit v1.2.3