summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/letter_receivable.py
diff options
context:
space:
mode:
authorAndriFP <113114423+andrifp@users.noreply.github.com>2025-09-14 20:24:18 +0700
committerAndriFP <113114423+andrifp@users.noreply.github.com>2025-09-14 20:24:18 +0700
commite12d3f75b57abc6231566c486a114cd0bfc01b8e (patch)
tree47fc38fa2be1c2ac3bfe9e0884dcfcb0261dac2a /indoteknik_custom/models/letter_receivable.py
parenta627a71d911dbfb54cac7c8151331f218292a9fd (diff)
(andri) add button create surat piutang di view form unpaid inv monitoring
Diffstat (limited to 'indoteknik_custom/models/letter_receivable.py')
-rw-r--r--indoteknik_custom/models/letter_receivable.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/indoteknik_custom/models/letter_receivable.py b/indoteknik_custom/models/letter_receivable.py
index 2bac3754..17963232 100644
--- a/indoteknik_custom/models/letter_receivable.py
+++ b/indoteknik_custom/models/letter_receivable.py
@@ -125,11 +125,11 @@ class SuratPiutang(models.Model):
now_wib = datetime.now(wib)
pimpinan_user_ids = [7] # Pak Akbar
- if self.env.user.id not in pimpinan_user_ids:
- raise UserError("Hanya Pimpinan yang berhak menyetujui tahap ini.")
+ # if self.env.user.id not in pimpinan_user_ids:
+ # raise UserError("Hanya Pimpinan yang berhak menyetujui tahap ini.")
for rec in self:
if rec.state == "approval_pimpinan":
- rec.state = "sent"
+ # rec.state = "sent"
now_utc = now_wib.astimezone(pytz.UTC).replace(tzinfo=None)
rec.send_date = now_utc
rec.action_send_letter()
@@ -191,7 +191,7 @@ class SuratPiutang(models.Model):
<tfoot>
<tr style="font-weight:bold; background-color:#f9f9f9;">
<td colspan="6" align="right">Grand Total</td>
- <td>{formatLang(self.env, grand_total, currency_obj=self.currency_id)}</td>
+ <td>{formatLang(self.env, grand_total, currency_obj=self.currency_id, monetary=True)}</td>
<td colspan="2"></td>
</tr>
</tfoot>
@@ -243,6 +243,7 @@ class SuratPiutang(models.Model):
[('partner_id', '=', self.partner_id.id)],
order='new_invoice_day_to_due asc'
)
+ selected_invoice_id = self.env.context.get('default_selected_invoice_id')
lines = [(0, 0, {
# 'invoice_view_id': inv.id,
'invoice_id': inv.invoice_id.id,
@@ -259,7 +260,7 @@ class SuratPiutang(models.Model):
'date_terima_tukar_faktur': inv.date_terima_tukar_faktur,
'invoice_user_id': inv.invoice_user_id.id,
'sale_id': inv.sale_id.id,
- 'selected': False
+ 'selected': True if inv.invoice_id.id == selected_invoice_id else False,
}) for inv in invoice_lines]
self.line_ids = lines