diff options
| -rw-r--r-- | indoteknik_custom/models/invoice_reklas.py | 9 |
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) |
