summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-06-20 01:35:07 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-06-20 01:35:07 +0000
commit4c4151581c9da1d548b355504f775ecaa60d8a2c (patch)
treee4a68f78175f911b4612a4a507154af97723cd9c /indoteknik_custom/models
parent111cb931a88fceb811cafa9551c0dbd809ea2446 (diff)
parent3097045aef8463edc41e417dfef4b0a6ae1d6bda (diff)
Merged in cab-po-finance (pull request #341)
Cab po finance
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