summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_move.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/account_move.py')
-rw-r--r--indoteknik_custom/models/account_move.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index c460a332..12e8ecba 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -3,7 +3,7 @@ from odoo.exceptions import AccessError, UserError, ValidationError
from markupsafe import escape as html_escape
from datetime import timedelta, date, datetime
from pytz import timezone, utc
-import logging
+import logging, json
import base64
import PyPDF2
import os
@@ -108,6 +108,31 @@ class AccountMove(models.Model):
)
internal_notes_contact = fields.Text(related='partner_id.comment', string="Internal Notes", readonly=True, help="Internal Notes dari contact utama customer.")
+ payment_info = fields.Text(
+ string="Payment Info",
+ compute='_compute_payment_info',
+ store=False,
+ help="Informasi pembayaran yang diambil dari payment yang sudah direkonsiliasi ke invoice ini."
+ )
+
+ def _compute_payment_info(self):
+ for rec in self:
+ summary = ""
+ try:
+ widget_data = rec.invoice_payments_widget
+ if widget_data:
+ data = json.loads(widget_data)
+ lines = []
+ for item in data.get('content', []):
+ amount = item.get('amount', 0.0)
+ date = item.get('date') or item.get('payment_date') or ''
+ formatted_amount = formatLang(self.env, amount, currency_obj=rec.currency_id)
+ lines.append(f"<i>Paid on {date}</i> - {formatted_amount}")
+ summary = "\n".join(lines) if lines else (data.get('title', '') or "")
+ except Exception:
+ summary = ""
+ rec.payment_info = summary
+
# def _check_and_lock_cbd(self):
# cbd_term = self.env['account.payment.term'].browse(26)
# today = date.today()