diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-07 13:41:09 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-07 13:41:09 +0700 |
| commit | 02511349a98e9488ed91795a062774f7d3ad26a6 (patch) | |
| tree | b80f7e062df2d4c7982660e76d93c7a382a0e0dc | |
| parent | d3538371691a43efbd5527b746c942bdef9fd1ba (diff) | |
(andri) Nomor CAB serta nominal terisi otomatis ketika create reklas
| -rw-r--r-- | indoteknik_custom/models/invoice_reklas.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py index d10d4c31..8641ca07 100644 --- a/indoteknik_custom/models/invoice_reklas.py +++ b/indoteknik_custom/models/invoice_reklas.py @@ -18,6 +18,17 @@ class InvoiceReklas(models.TransientModel): ('pembelian', 'Pembelian'), ], string='Reklas Tipe') + @api.model + def default_get(self, fields): + res = super().default_get(fields) + active_ids = self._context.get('active_ids', []) + if active_ids: + move = self.env['account.move'].browse(active_ids[0]) + if move.move_type == 'entry': + res['reklas_id'] = move.id + res['pay_amt'] = move.amount_total # atau amount_residual jika mau sisa + return res + @api.onchange('reklas_type') def _onchange_reklas_type(self): if self.reklas_type == 'penjualan': |
