summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-11-14 08:47:53 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-11-14 08:47:53 +0700
commit1c0e5304620246d7cebd2c73278fabe9aeadd291 (patch)
tree4bfd65c5c8b3621fa055e0a8477ac4afd18b6bad
parent2503da29cac8381306590fe43b91483a1b1b53c0 (diff)
parentae89c43f6efa66ac7e332e62ce6cc6817f75c16d (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
merge
-rw-r--r--indoteknik_custom/models/account_move.py35
-rw-r--r--indoteknik_custom/models/advance_payment_request.py3
-rw-r--r--indoteknik_custom/models/res_partner.py3
-rw-r--r--indoteknik_custom/views/account_move.xml2
4 files changed, 37 insertions, 6 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 684ef335..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()
@@ -161,7 +186,8 @@ class AccountMove(models.Model):
def action_sync_promise_date(self):
self.ensure_one()
finance_user_ids = [688]
- if self.env.user.id not in finance_user_ids:
+ is_it = self.env.user.has_group('indoteknik_custom.group_role_it')
+ if self.env.user.id not in finance_user_ids and not is_it:
raise UserError('Hanya Finance (Widya) yang dapat menggunakan fitur ini.')
if not self.customer_promise_date:
raise UserError("Isi Janji Bayar terlebih dahulu sebelum melakukan sinkronisasi.")
@@ -169,10 +195,11 @@ class AccountMove(models.Model):
other_invoices = self.env['account.move'].search([
('id', '!=', self.id),
('partner_id', '=', self.partner_id.id),
- ('invoice_date_due', '=', self.invoice_date_due),
+ ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']),
('move_type', '=', 'out_invoice'),
('state', '=', 'posted'),
- ('date_terima_tukar_faktur', '!=', False)
+ ('date_terima_tukar_faktur', '!=', False),
+ ('invoice_payment_term_id.name', 'ilike', 'tempo')
])
lines = []
for inv in other_invoices:
diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py
index 6ea1c160..42097923 100644
--- a/indoteknik_custom/models/advance_payment_request.py
+++ b/indoteknik_custom/models/advance_payment_request.py
@@ -909,8 +909,7 @@ class ReimburseLine(models.Model):
date = fields.Date(string='Tanggal', required=True, default=fields.Date.today)
account_id = fields.Many2one(
'account.account',
- string='Jenis Biaya', tracking=3,
- domain="[('id', 'in', [484, 486, 527, 529, 530, 471, 473, 492, 493, 488, 625, 528, 533, 534])]"
+ string='Jenis Biaya', tracking=3
)
description = fields.Text(string='Description', required=True, tracking=3)
distance_departure = fields.Float(string='Pergi (Km)', tracking=3)
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index f80bbcb6..7f4feb75 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -200,6 +200,9 @@ class ResPartner(models.Model):
string='Previous Payment Term'
)
+ property_product_pricelist = fields.Many2one(
+ tracking=True
+ )
@api.depends("street", "street2", "city", "state_id", "country_id", "blok", "nomor", "rt", "rw", "kelurahan_id",
"kecamatan_id")
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 9df03674..c5f9580c 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -140,6 +140,8 @@
<field name="shipper_faktur_id" optional="hide"/>
<field name="resi_tukar_faktur" optional="hide"/>
<field name="date_terima_tukar_faktur" optional="hide"/>
+ <field name="payment_info" optional="hide" widget="html"/>
+ <field name="customer_promise_date" optional="hide"/>
</field>
</field>
</record>