summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/invoice_reklas.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py
index 5145e098..4ed7f0bf 100644
--- a/indoteknik_custom/models/invoice_reklas.py
+++ b/indoteknik_custom/models/invoice_reklas.py
@@ -87,10 +87,10 @@ class InvoiceReklas(models.TransientModel):
po_name = invoice.purchase_order_id.name if invoice.purchase_order_id else ''
# Susun nama referensi dengan aman
- ref_name = 'REKLAS {} UANG MUKA {} {}{} {}'.format(
+ ref_name = 'REKLAS {} UANG MUKA {}{}{} {}'.format(
self.reklas_id.name or '',
'PENJUALAN' if self.reklas_type == 'penjualan' else 'PEMBELIAN',
- invoice.name or '',
+ f" {invoice.name}" if invoice.name != self.reklas_id.name else '',
f" - {po_name}" if po_name else '',
invoice.partner_id.name or ''
)
@@ -102,11 +102,15 @@ class InvoiceReklas(models.TransientModel):
'journal_id': 13
}
+ if invoice.purchase_order_id:
+ parameters_header['purchase_order_id'] = invoice.purchase_order_id.id
+
account_move = request.env['account.move'].create([parameters_header])
_logger.info('Success Reklas with %s' % account_move.name)
# ✅ Set Bill asal sebagai source document
- account_move.bill_id = invoice.id
+ if invoice.move_type == 'in_invoice':
+ account_move.bill_id = invoice.id
# Tambahkan info asal invoice ke jurnal (opsional)
account_move.invoice_origin = invoice.name