From ecf44f0bf4070de945baa5a2e0e3641a1a1018b7 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 12 Jan 2026 12:26:45 +0700 Subject: push reklas --- fixco_custom/models/invoice_reklas.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fixco_custom/models/invoice_reklas.py') diff --git a/fixco_custom/models/invoice_reklas.py b/fixco_custom/models/invoice_reklas.py index 584d357..37fd4d7 100644 --- a/fixco_custom/models/invoice_reklas.py +++ b/fixco_custom/models/invoice_reklas.py @@ -102,6 +102,8 @@ class InvoiceReklas(models.TransientModel): current_time = datetime.now() for invoice in invoices: + if invoice.reklas_id: + raise UserError('Invoice {} sudah di reklas'.format(invoice.name)) # Ambil nama PO jika ada po_name = invoice.purchase_id.name if invoice.purchase_id else '' @@ -120,6 +122,7 @@ class InvoiceReklas(models.TransientModel): 'date': current_time, 'journal_id': 19, 'sale_id': invoice.sale_id.id, + 'purchase_order_id': invoice.purchase_order_id.id, 'reklas': True, } @@ -127,6 +130,7 @@ class InvoiceReklas(models.TransientModel): parameters_header['purchase_id'] = invoice.purchase_id.id account_move = request.env['account.move'].create([parameters_header]) + invoice.reklas_id = account_move.id _logger.info('Success Reklas with %s' % account_move.name) # ✅ Set Bill asal sebagai source document -- cgit v1.2.3