summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-06-07 13:46:46 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-06-07 13:46:46 +0700
commit49dcd6e8111483cd8f64aa2401a41b3a8d57a1dc (patch)
treead8b08a09a867a21f6eb476cf46d4c6a56ede339
parent02511349a98e9488ed91795a062774f7d3ad26a6 (diff)
(andri) onchange Nomor CAB serta nominal terisi otomatis ketika create reklas
-rw-r--r--indoteknik_custom/models/invoice_reklas.py9
1 files changed, 9 insertions, 0 deletions
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)