diff options
| -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': |
