summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_api/controllers/api_v1/stock_picking.py79
-rwxr-xr-xindoteknik_custom/__manifest__.py2
-rwxr-xr-xindoteknik_custom/models/__init__.py2
-rw-r--r--indoteknik_custom/models/account_move.py52
-rw-r--r--indoteknik_custom/models/account_move_due_extension.py5
-rw-r--r--indoteknik_custom/models/advance_payment_request.py67
-rw-r--r--indoteknik_custom/models/automatic_purchase.py6
-rw-r--r--indoteknik_custom/models/commision.py4
-rw-r--r--indoteknik_custom/models/commission_internal.py392
-rw-r--r--indoteknik_custom/models/coretax_fatur.py4
-rw-r--r--indoteknik_custom/models/dunning_run.py1
-rwxr-xr-xindoteknik_custom/models/purchase_order.py15
-rw-r--r--indoteknik_custom/models/refund_sale_order.py108
-rw-r--r--indoteknik_custom/models/res_partner.py4
-rwxr-xr-xindoteknik_custom/models/sale_order.py82
-rw-r--r--indoteknik_custom/models/sj_tele.py10
-rw-r--r--indoteknik_custom/models/stock_move.py114
-rw-r--r--indoteknik_custom/models/stock_picking.py127
-rw-r--r--indoteknik_custom/models/tukar_guling.py20
-rw-r--r--indoteknik_custom/models/tukar_guling_po.py4
-rw-r--r--indoteknik_custom/models/uom_uom.py6
-rw-r--r--indoteknik_custom/report/purchase_report.xml5
-rw-r--r--indoteknik_custom/report/report_tutup_tempo.xml69
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv6
-rw-r--r--indoteknik_custom/views/account_move.xml2
-rw-r--r--indoteknik_custom/views/advance_payment_request.xml19
-rw-r--r--indoteknik_custom/views/advance_payment_settlement.xml6
-rw-r--r--indoteknik_custom/views/commission_internal.xml160
-rw-r--r--indoteknik_custom/views/dunning_run.xml1
-rw-r--r--indoteknik_custom/views/ir_sequence.xml3
-rw-r--r--indoteknik_custom/views/refund_sale_order.xml4
-rw-r--r--indoteknik_custom/views/res_partner.xml1
-rwxr-xr-xindoteknik_custom/views/sale_order.xml14
-rw-r--r--indoteknik_custom/views/stock_picking.xml48
-rw-r--r--indoteknik_custom/views/uom_uom.xml14
35 files changed, 1256 insertions, 200 deletions
diff --git a/indoteknik_api/controllers/api_v1/stock_picking.py b/indoteknik_api/controllers/api_v1/stock_picking.py
index fe82e665..c19812f5 100644
--- a/indoteknik_api/controllers/api_v1/stock_picking.py
+++ b/indoteknik_api/controllers/api_v1/stock_picking.py
@@ -124,35 +124,86 @@ class StockPicking(controller.Controller):
@http.route(prefix + 'stock-picking/<scanid>/documentation', auth='public', methods=['PUT', 'OPTIONS'], csrf=False)
@controller.Controller.must_authorized()
def write_partner_stock_picking_documentation(self, scanid, **kw):
- sj_document = kw.get('sj_document') if 'sj_document' in kw else None
paket_document = kw.get('paket_document') if 'paket_document' in kw else None
dispatch_document = kw.get('dispatch_document') if 'dispatch_document' in kw else None
- self_pu= kw.get('self_pu') if 'self_pu' in kw else None
+ self_pu = kw.get('self_pu') if 'self_pu' in kw else None
# ===== Cari picking by id / picking_code =====
- picking_data = False
+ picking = False
if scanid.isdigit() and int(scanid) < 2147483646:
- picking_data = request.env['stock.picking'].search([('id', '=', int(scanid))], limit=0)
+ picking = request.env['stock.picking'].search([('id', '=', int(scanid))], limit=0)
+ if not picking:
+ picking = request.env['stock.picking'].search([('picking_code', '=', scanid)], limit=0)
+ if not picking:
+ return self.response(code=403, description='picking not found')
- if not picking_data:
- picking_data = request.env['stock.picking'].search([('picking_code', '=', scanid)], limit=0)
+ # ===== Ambil MULTIPLE SJ dari form: sj_documentations=...&sj_documentations=... =====
+ form = request.httprequest.form or {}
+ sj_list = form.getlist('sj_documentations') # list of base64 strings
- if not picking_data:
- return self.response(code=403, description='picking not found')
+ # fallback: kalau FE kirim single dengan nama yang sama (bukan list)
+ if not sj_list and 'sj_documentations' in kw and kw.get('sj_documentations'):
+ sj_list = [kw.get('sj_documentations')]
params = {}
- if sj_document:
- params['sj_documentation'] = sj_document
- if self_pu:
- params['driver_arrival_date'] = datetime.utcnow()
if paket_document:
params['paket_documentation'] = paket_document
params['driver_arrival_date'] = datetime.utcnow()
if dispatch_document:
params['dispatch_documentation'] = dispatch_document
+ if sj_list and self_pu:
+ params['driver_arrival_date'] = datetime.utcnow()
- picking_data.write(params)
- return self.response({'name': picking_data.name})
+ if params:
+ picking.write(params)
+
+ if sj_list:
+ Child = request.env['stock.picking.sj.document'].sudo()
+ seq = (picking.sj_documentations[:1].sequence or 10) if picking.sj_documentations else 10
+ for b64 in sj_list:
+ if not b64:
+ continue
+ Child.create({
+ 'picking_id': picking.id,
+ 'sequence': seq,
+ 'image': b64,
+ })
+ seq += 10
+
+ return self.response({'name': picking.name})
+
+ # @http.route(prefix + 'stock-picking/<scanid>/documentation', auth='public', methods=['PUT', 'OPTIONS'], csrf=False)
+ # @controller.Controller.must_authorized()
+ # def write_partner_stock_picking_documentation(self, scanid, **kw):
+ # sj_document = kw.get('sj_document') if 'sj_document' in kw else None
+ # paket_document = kw.get('paket_document') if 'paket_document' in kw else None
+ # dispatch_document = kw.get('dispatch_document') if 'dispatch_document' in kw else None
+ # self_pu= kw.get('self_pu') if 'self_pu' in kw else None
+ #
+ # # ===== Cari picking by id / picking_code =====
+ # picking_data = False
+ # if scanid.isdigit() and int(scanid) < 2147483646:
+ # picking_data = request.env['stock.picking'].search([('id', '=', int(scanid))], limit=0)
+ #
+ # if not picking_data:
+ # picking_data = request.env['stock.picking'].search([('picking_code', '=', scanid)], limit=0)
+ #
+ # if not picking_data:
+ # return self.response(code=403, description='picking not found')
+ #
+ # params = {}
+ # if sj_document:
+ # params['sj_documentation'] = sj_document
+ # if self_pu:
+ # params['driver_arrival_date'] = datetime.utcnow()
+ # if paket_document:
+ # params['paket_documentation'] = paket_document
+ # params['driver_arrival_date'] = datetime.utcnow()
+ # if dispatch_document:
+ # params['dispatch_documentation'] = dispatch_document
+ #
+ # picking_data.write(params)
+ # return self.response({'name': picking_data.name})
@http.route(prefix + 'webhook/biteship', type='json', auth='public', methods=['POST'], csrf=False)
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 961e6a94..75c83d68 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -192,6 +192,8 @@
'views/close_tempo_mail_template.xml',
'views/domain_apo.xml',
'views/sourcing.xml'
+ 'views/uom_uom.xml',
+ 'views/commission_internal.xml'
],
'demo': [],
'css': [],
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 7f946b57..30898b99 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -164,3 +164,5 @@ from . import sj_tele
from . import partial_delivery
from . import domain_apo
from . import sourcing_job_order
+from . import uom_uom
+from . import commission_internal
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 684ef335..6212664e 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
@@ -11,6 +11,7 @@ import re
from terbilang import Terbilang
from collections import defaultdict
from odoo.tools.misc import formatLang
+import socket
_logger = logging.getLogger(__name__)
@@ -32,7 +33,6 @@ class AccountMove(models.Model):
new_due_date = fields.Date(string='New Due')
counter = fields.Integer(string="Counter", default=0)
cost_centre_id = fields.Many2one('cost.centre', string='Cost Centre')
- analytic_account_ids = fields.Many2many('account.analytic.account', string='Analytic Account')
due_line = fields.One2many('due.extension.line', 'invoice_id', compute='_compute_due_line', string='Due Extension Lines')
no_faktur_pajak = fields.Char(string='No Faktur Pajak')
date_completed = fields.Datetime(string='Date Completed')
@@ -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"<li><i>Paid on {date}</i> - {formatted_amount}</li>")
+ summary = f"<ul>{''.join(lines)}</ul>" 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:
@@ -192,7 +219,16 @@ class AccountMove(models.Model):
'target': 'new',
}
+ @staticmethod
+ def is_local_env():
+ hostname = socket.gethostname().lower()
+ keywords = ['andri', 'miqdad', 'fin', 'stephan', 'hafid', 'nathan']
+ return any(keyword in hostname for keyword in keywords)
+
def send_due_invoice_reminder(self):
+ if self.is_local_env():
+ _logger.warning("📪 Local environment detected — skip sending email reminders.")
+ return
today = fields.Date.today()
target_dates = [
today + timedelta(days=7),
@@ -214,6 +250,9 @@ class AccountMove(models.Model):
self._send_invoice_reminders(invoices, mode='due')
def send_overdue_invoice_reminder(self):
+ if self.is_local_env():
+ _logger.warning("📪 Local environment detected — skip sending email reminders.")
+ return
today = fields.Date.today()
invoices = self.env['account.move'].search([
('move_type', '=', 'out_invoice'),
@@ -229,6 +268,9 @@ class AccountMove(models.Model):
self._send_invoice_reminders(invoices, mode='overdue')
def _send_invoice_reminders(self, invoices, mode):
+ if self.is_local_env():
+ _logger.warning("📪 Local environment detected — skip sending email reminders.")
+ return
today = fields.Date.today()
template = self.env.ref('indoteknik_custom.mail_template_invoice_due_reminder')
diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py
index 55fc6c65..951d9745 100644
--- a/indoteknik_custom/models/account_move_due_extension.py
+++ b/indoteknik_custom/models/account_move_due_extension.py
@@ -115,6 +115,11 @@ class DueExtension(models.Model):
self.order_id.check_credit_limit()
self.order_id.approval_status = 'pengajuan1'
return self.order_id._create_approval_notification('Sales Manager')
+
+ if self.order_id._requires_approval_team_sales():
+ self.order_id.check_credit_limit()
+ self.order_id.approval_status = 'pengajuan1'
+ return self.order_id._create_approval_notification('Team Sales')
sales = self.env['sale.order'].browse(self.order_id.id)
diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py
index 5a465ca4..ec23de63 100644
--- a/indoteknik_custom/models/advance_payment_request.py
+++ b/indoteknik_custom/models/advance_payment_request.py
@@ -159,7 +159,7 @@ class AdvancePaymentRequest(models.Model):
self.nominal = self.grand_total_reimburse
def _compute_is_current_user_ap(self):
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
is_ap = self.env.user.id in ap_user_ids
for line in self:
line.is_current_user_ap = is_ap
@@ -372,8 +372,9 @@ class AdvancePaymentRequest(models.Model):
def action_view_journal_uangmuka(self):
self.ensure_one()
- ap_user_ids = [23, 9468]
- if self.env.user.id not in ap_user_ids:
+ ap_user_ids = [23, 9468, 16729]
+ is_it = self.env.user.has_group('indoteknik_custom.group_role_it')
+ if self.env.user.id not in ap_user_ids and not is_it:
raise UserError('Hanya User AP yang dapat menggunakan fitur ini.')
if not self.move_id:
@@ -497,14 +498,14 @@ class AdvancePaymentRequest(models.Model):
# jakarta_tz = pytz.timezone('Asia/Jakarta')
# now = datetime.now(jakarta_tz).replace(tzinfo=None)
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
if self.env.user.id not in ap_user_ids:
raise UserError('Hanya User AP yang dapat menggunakan fitur ini.')
for rec in self:
if not rec.attachment_file_image and not rec.attachment_file_pdf:
raise UserError(
- f'Tidak bisa konfirmasi pembayaran PUM {rec.name or ""} '
+ f'Tidak bisa konfirmasi pembayaran {rec.number or ""} '
f'karena belum ada bukti attachment (PDF/Image).'
)
@@ -572,7 +573,7 @@ class AdvancePaymentRequest(models.Model):
)
elif rec.status == 'pengajuan2':
- ap_user_ids = [23, 9468] # List user ID yang boleh approve sebagai Finance AP
+ ap_user_ids = [23, 9468, 16729] # List user ID yang boleh approve sebagai Finance AP
if self.env.user.id not in ap_user_ids:
raise UserError("Hanya AP yang berhak menyetujui tahap ini.")
rec.name_approval_ap = self.env.user.name
@@ -614,7 +615,7 @@ class AdvancePaymentRequest(models.Model):
def action_ap_only(self):
self.ensure_one()
- ap_user_ids = [23, 9468] # Ganti sesuai kebutuhan
+ ap_user_ids = [23, 9468, 16729] # Ganti sesuai kebutuhan
if self.env.user.id not in ap_user_ids:
raise UserError('Hanya User AP yang dapat menggunakan fitur ini.')
@@ -845,9 +846,9 @@ class AdvancePaymentUsageLine(models.Model):
attachment_filename_pdf = fields.Char(string='Filename PDF')
account_id = fields.Many2one(
- 'account.account', string='Jenis Biaya', tracking=3,
- domain="[('id', 'in', [484, 486, 488, 506, 507, 625, 471, 519, 527, 528, 529, 530, 565])]" # ID Jenis Biaya yang dibutuhkan
+ 'account.account', string='Jenis Biaya', tracking=3 # ID Jenis Biaya yang dibutuhkan
)
+ # domain="[('id', 'in', [484, 486, 488, 506, 507, 625, 471, 519, 527, 528, 529, 530, 565])]" # ID Jenis Biaya yang dibutuhkan
is_current_user_ap = fields.Boolean(
string="Is Current User AP",
@@ -855,7 +856,7 @@ class AdvancePaymentUsageLine(models.Model):
)
def _compute_is_current_user_ap(self):
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
is_ap = self.env.user.id in ap_user_ids
for line in self:
line.is_current_user_ap = is_ap
@@ -875,7 +876,7 @@ class AdvancePaymentUsageLine(models.Model):
@api.onchange('done_attachment')
def _onchange_done_attachment(self):
- ap_user_ids = [23, 9468] # List user ID yang boleh approve sebagai Finance AP
+ ap_user_ids = [23, 9468, 16729] # List user ID yang boleh approve sebagai Finance AP
if self.done_attachment and self.env.user.id not in ap_user_ids:
self.done_attachment = False
@@ -908,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)
@@ -944,7 +944,7 @@ class ReimburseLine(models.Model):
)
def _compute_is_current_user_ap(self):
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
is_ap = self.env.user.id in ap_user_ids
for line in self:
line.is_current_user_ap = is_ap
@@ -989,7 +989,7 @@ class AdvancePaymentSettlement(models.Model):
name = fields.Char(string='Nama', readonly=True, tracking=3)
title = fields.Char(string='Judul', tracking=3)
goals = fields.Text(string='Tujuan', tracking=3)
- related = fields.Char(string='Terkait', tracking=3)
+ related = fields.Char(string='Dok. Terkait', tracking=3)
# pemberian_line_ids = fields.One2many(
# 'advance.payment.settlement.line', 'realization_id', string='Rincian Pemberian'
@@ -1008,7 +1008,13 @@ class AdvancePaymentSettlement(models.Model):
# value_down_payment = fields.Float(string='PUM', tracking=3)
remaining_value = fields.Float(string='Sisa Uang PUM', tracking=3, compute='_compute_remaining_value')
- note_approval = fields.Text(string='Note Persetujuan', tracking=3)
+ def _get_default_note_approval(self):
+ template = (
+ "Demikian dokumen Realisasi Uang Muka ini saya buat, dengan ini saya meminta persetujuan dibawah atas hasil penggunaan uang muka yang saya gunakan untuk kebutuhan realisasi "
+ )
+ return template
+
+ note_approval = fields.Text(string='Note Persetujuan', tracking=3, default=_get_default_note_approval)
name_approval_departement = fields.Char(string='Approval Departement')
name_approval_ap = fields.Char(string='Approval AP')
@@ -1081,13 +1087,13 @@ class AdvancePaymentSettlement(models.Model):
)
def _compute_is_current_user_ap(self):
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
is_ap = self.env.user.id in ap_user_ids
for line in self:
line.is_current_user_ap = is_ap
def action_toggle_check_attachment(self):
- ap_user_ids = [23, 9468]
+ ap_user_ids = [23, 9468, 16729]
if self.env.user.id not in ap_user_ids:
raise UserError('Hanya User AP yang dapat menggunakan tombol ini.')
@@ -1121,8 +1127,9 @@ class AdvancePaymentSettlement(models.Model):
def action_view_journal_uangmuka(self):
self.ensure_one()
- ap_user_ids = [23, 9468]
- if self.env.user.id not in ap_user_ids:
+ ap_user_ids = [23, 9468, 16729]
+ is_it = self.env.user.has_group('indoteknik_custom.group_role_it')
+ if self.env.user.id not in ap_user_ids and not is_it:
raise UserError('Hanya User AP yang dapat menggunakan fitur ini.')
if not self.move_id:
@@ -1185,7 +1192,7 @@ class AdvancePaymentSettlement(models.Model):
def action_cab(self):
self.ensure_one()
- ap_user_ids = [23, 9468] # List user ID yang boleh approve sebagai Finance AP
+ ap_user_ids = [23, 9468, 16729] # List user ID yang boleh approve sebagai Finance AP
if self.env.user.id not in ap_user_ids:
raise UserError('Hanya User AP yang dapat menggunakan ini.')
if self.move_id:
@@ -1194,7 +1201,8 @@ class AdvancePaymentSettlement(models.Model):
if not self.pum_id or not self.pum_id.move_id:
raise UserError("PUM terkait atau CAB belum tersedia.")
- partner_id = self.pum_id.user_id.partner_id.id
+ # partner_id = self.pum_id.user_id.partner_id.id
+ partner_id = self.pum_id.applicant_name.partner_id.id
cab_move = self.pum_id.move_id
# Account Bank Intransit dari CAB:
@@ -1310,7 +1318,7 @@ class AdvancePaymentSettlement(models.Model):
)
elif rec.status == 'pengajuan2':
- ap_user_ids = [23, 9468] # List user ID yang boleh approve sebagai Finance AP
+ ap_user_ids = [23, 9468, 16729] # List user ID yang boleh approve sebagai Finance AP
if self.env.user.id not in ap_user_ids:
raise UserError("Hanya AP yang berhak menyetujui tahap ini.")
rec.name_approval_ap = self.env.user.name
@@ -1413,7 +1421,7 @@ class AdvancePaymentCreateBill(models.TransientModel):
apr_id = fields.Many2one('advance.payment.request', string='Advance Payment Request', required=True)
account_id = fields.Many2one(
'account.account', string='Bank Intransit', required=True,
- domain="[('id', 'in', [573, 389, 392])]" # ID Bank Intransit
+ domain="[('id', 'in', [573, 389, 392, 683, 380])]" # ID Bank Intransit
)
nominal = fields.Float(string='Nominal', related='apr_id.nominal')
@@ -1424,7 +1432,8 @@ class AdvancePaymentCreateBill(models.TransientModel):
# raise UserError('Hanya AP yang dapat menggunakan ini.')
apr = self.apr_id
- partner_id = apr.user_id.partner_id.id
+ # partner_id = apr.user_id.partner_id.id
+ partner_id = apr.applicant_name.partner_id.id
ref_label = f'{apr.number} - {apr.detail_note or "-"}'
@@ -1496,8 +1505,9 @@ class CreateReimburseCabWizard(models.TransientModel):
raise UserError("Tidak ada rincian reimburse yang bisa dijurnalkan.")
lines = []
- partner_id = request.user_id.partner_id.id
-
+ # partner_id = request.user_id.partner_id.id
+ partner_id = request.applicant_name.partner_id.id
+ ref_label = f'{request.number} - {request.detail_note or "-"}'
# 1. Buat Jurnal DEBIT dari setiap baris reimburse
for line in request.reimburse_line_ids:
if not line.account_id:
@@ -1515,12 +1525,11 @@ class CreateReimburseCabWizard(models.TransientModel):
lines.append((0, 0, {
'account_id': self.account_id.id,
'partner_id': partner_id,
- 'name': f'Reimburse {request.number}',
+ 'name': ref_label,
'debit': 0,
'credit': request.grand_total_reimburse,
}))
- ref_label = f'{request.number} - {request.detail_note or "-"}'
# 3. Buat Journal Entry
move = self.env['account.move'].create({
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index d9ec17f4..4b0ce325 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -239,7 +239,8 @@ class AutomaticPurchase(models.Model):
'picking_type_id': 28,
'date_order': current_time,
'from_apo': True,
- 'note_description': 'Automatic PO'
+ 'note_description': 'Automatic PO',
+ 'show_description': False if vendor_id == 5571 else True,
}
new_po = self.env['purchase.order'].create(param_header)
@@ -283,7 +284,8 @@ class AutomaticPurchase(models.Model):
'ending_price': line.last_price,
'taxes_id': [(6, 0, [line.taxes_id.id])] if line.taxes_id else False,
'so_line_id': sales_match.sale_line_id.id if sales_match else None,
- 'so_id': sales_match.sale_id.id if sales_match else None
+ 'so_id': sales_match.sale_id.id if sales_match else None,
+ 'show_description': False if vendor_id == 5571 else True,
}
new_po_line = self.env['purchase.order.line'].create(param_line)
line.current_po_id = new_po.id
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py
index a937e2d0..441dd54f 100644
--- a/indoteknik_custom/models/commision.py
+++ b/indoteknik_custom/models/commision.py
@@ -423,8 +423,8 @@ class CustomerCommision(models.Model):
def action_confirm_customer_commision(self):
jakarta_tz = pytz.timezone('Asia/Jakarta')
now = datetime.now(jakarta_tz)
-
- now_naive = now.replace(tzinfo=None)
+ now_utc = now.astimezone(pytz.utc)
+ now_naive = now_utc.replace(tzinfo=None)
if not self.status or self.status == 'draft':
self.status = 'pengajuan1'
diff --git a/indoteknik_custom/models/commission_internal.py b/indoteknik_custom/models/commission_internal.py
new file mode 100644
index 00000000..cd6da380
--- /dev/null
+++ b/indoteknik_custom/models/commission_internal.py
@@ -0,0 +1,392 @@
+from odoo import models, api, fields
+from odoo.exceptions import AccessError, UserError, ValidationError
+from datetime import timedelta, date
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class CommissionInternal(models.Model):
+ _name = 'commission.internal'
+ _description = 'Commission Internal'
+ _order = 'date_doc, id desc'
+ _inherit = ['mail.thread']
+ _rec_name = 'number'
+
+ number = fields.Char(string='Document No', index=True, copy=False, readonly=True)
+ date_doc = fields.Date(string='Document Date', required=True)
+ month = fields.Selection([
+ ('01', 'January'), ('02', 'February'), ('03', 'March'),
+ ('04', 'April'), ('05', 'May'), ('06', 'June'),
+ ('07', 'July'), ('08', 'August'), ('09', 'September'),
+ ('10', 'October'), ('11', 'November'), ('12', 'December')
+ ], string="Commission Month")
+ year = fields.Selection([(str(y), str(y)) for y in range(2025, 2036)], string="Commission Year")
+ description = fields.Char(string='Description')
+ comment = fields.Char(string='Comment')
+ commission_internal_line = fields.One2many('commission.internal.line', 'commission_internal_id', string='Lines',
+ auto_join=True, order='account_move_id asc')
+ commission_internal_result = fields.One2many('commission.internal.result', 'commission_internal_id', string='Result',
+ auto_join=True, order='account_move_id asc')
+
+ @api.model
+ def create(self, vals):
+ vals['number'] = self.env['ir.sequence'].next_by_code('commission.internal') or '0'
+ result = super(CommissionInternal, self).create(vals)
+ return result
+
+ def _get_commission_internal_bank_account_ids(self):
+ bank_ids = self.env['ir.config_parameter'].sudo().get_param('commission.internal.bank.account.id')
+ if not bank_ids:
+ return []
+ return [int(x.strip()) for x in bank_ids.split(',') if x.strip().isdigit()]
+
+ def _get_period_range(self, period_year, period_month):
+ """Return (date_start, date_end) using separate year and month fields."""
+ self.ensure_one() # make sure it's called on a single record
+
+ year_str = period_year or ''
+ month_str = period_month or ''
+
+ # Validate both fields exist
+ if not (year_str.isdigit() and month_str.isdigit()):
+ return None, None
+
+ year = int(year_str)
+ month = int(month_str)
+
+ # First day of this month
+ dt_start = date(year, month, 1)
+
+ # Compute first day of next month
+ if month == 12:
+ next_month = date(year + 1, 1, 1)
+ else:
+ next_month = date(year, month + 1, 1)
+
+ # Last day = one day before next month's first day
+ dt_end = next_month - timedelta(days=1)
+
+ return dt_start, dt_end
+
+ # CREDIT > 0
+ def _calculate_exclude_credit(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('credit', '>', 0),
+ ('status', '=', False)
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ line.helper1 = 'CREDIT'
+
+ # INV/20
+ def _calculate_keyword_invoice(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', '=', False),
+ ('label', 'ilike', '%INV/20%'),
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ # parse label and set helper
+ for line in lines:
+ line.helper1 = 'INV/20'
+
+ # ONGKOS KIRIM SO/20
+ def _calculate_keyword_deliveryamt(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', '=', False),
+ ('label', 'ilike', '%ONGKOS KIRIM SO/20%'),
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ line.helper1 = 'ONGKOS KIRIM SO/20'
+
+ # Payment SO/20
+ def _calculate_keyword_payment(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', '=', False),
+ ('label', 'ilike', '%Payment SO/20%'),
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ line.helper1 = 'Payment SO/20'
+
+ # UANG MUKA PENJUALAN SO/20
+ def _calculate_keyword_dp(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', '=', False),
+ ('label', 'ilike', '%UANG MUKA PENJUALAN SO/20%'),
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ line.helper1 = 'UANG MUKA PENJUALAN SO/20'
+
+ def _calculate_keyword_undefined(self):
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', '=', False),
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ line.helper1 = 'UNDEFINED'
+
+ def _parse_label_helper2(self):
+ exception = ['CREDIT', 'UNDEFINED']
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper1', 'not in', exception)
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ for line in lines:
+ clean_label = line.label.replace('-', ' ').replace(',', ' ')
+ list_label = clean_label.split()
+ list_helper2 = []
+ for key in list_label:
+ clean_key = key.replace(',', '') # delete commas for make sure
+ if clean_key[:6] == 'INV/20':
+ list_helper2.append(clean_key)
+ elif clean_key[:5] == 'SO/20':
+ list_invoice = self._switch_so_to_inv(clean_key)
+ str_invoice = ' '.join(list_invoice)
+ list_helper2.append(str_invoice)
+ result_helper2 = ' '.join(list_helper2)
+ line.helper2 = result_helper2
+
+ def _switch_so_to_inv(self, order):
+ list_state = ['sale', 'done']
+ result = []
+ query = [
+ ('state', 'in', list_state),
+ ('name', '=', order)
+ ]
+ sales = self.env['sale.order'].search(query)
+ if sales:
+ for sale in sales:
+ if sale.invoice_ids:
+ for invoice in sale.invoice_ids:
+ if invoice.state == 'posted':
+ result.append(invoice.name)
+ else:
+ result.append(order)
+ else:
+ result.append(order)
+ return result
+
+ # fill later TODO @stephan
+ def calculate_commission_internal_result(self):
+ exception = ['ONGKOS KIRIM SO/20']
+ query = [
+ ('commission_internal_id.id', '=', self.id),
+ ('helper2', '!=', False),
+ ('helper1', 'not in', exception)
+ ]
+ lines = self.env['commission.internal.line'].search(query)
+ all_invoices_and_sales = []
+ for line in lines:
+ list_so = list_invoice = []
+ list_key = line.helper2.split()
+ for key in list_key:
+ if key[:6] == 'INV/20':
+ list_invoice.append(key)
+ if key[:5] == 'SO/20':
+ list_so.append(key)
+ invoices = self.env['account.move'].search([('name', 'in', list_invoice)])
+ orders = self.env['sale.order'].search([('name', 'in', list_so)])
+ invoice_data = invoices.mapped(lambda r: {
+ 'res_name': 'account.move',
+ 'res_id': r.id,
+ 'name': r.name,
+ 'date': r.invoice_date,
+ 'customer': r.partner_id.name,
+ 'salesperson': r.user_id.name,
+ 'amount_untaxed': r.amount_untaxed,
+ 'amount_tax': r.amount_tax,
+ 'amount_total': r.amount_total,
+ 'uang_masuk_line_id': line.account_move_line_id.id,
+ 'uang_masuk_id': line.account_move_id.id,
+ 'date_uang_masuk': line.date,
+ 'label_uang_masuk': line.label,
+ 'nomor_uang_masuk': line.number,
+ 'uang_masuk': line.balance,
+ # 'linenetamt_prorate': net_amount_prorate,
+ 'helper1': line.helper1,
+ 'commission_internal_id': line.commission_internal_id.id,
+ 'commission_internal_line_id': line.id,
+ 'helper2': r.state,
+ })
+ sale_data = orders.mapped(lambda r: {
+ 'res_name': 'sale.order',
+ 'res_id': r.id,
+ 'name': r.name,
+ 'date': r.date_order,
+ 'customer': r.partner_id.name,
+ 'salesperson': r.user_id.name,
+ 'amount_untaxed': r.amount_untaxed,
+ 'amount_tax': r.amount_tax,
+ 'amount_total': r.grand_total,
+ 'uang_masuk_line_id': line.account_move_line_id.id,
+ 'uang_masuk_id': line.account_move_id.id,
+ 'date_uang_masuk': line.date,
+ 'label_uang_masuk': line.label,
+ 'nomor_uang_masuk': line.number,
+ 'uang_masuk': line.balance,
+ # 'linenetamt_prorate': net_amount_prorate,
+ 'helper1': line.helper1,
+ 'commission_internal_id': line.commission_internal_id.id,
+ 'commission_internal_line_id': line.id,
+ 'helper2': r.state,
+ })
+ invoices_and_sales = invoice_data + sale_data
+ sum_amount_total = sum(item['amount_total'] for item in invoices_and_sales)
+ for item in invoices_and_sales:
+ item['sum_amount_total'] = sum_amount_total
+ all_invoices_and_sales.extend(invoices_and_sales)
+
+ for data in all_invoices_and_sales:
+ # total_amount = sum(item.get('amount_total', 0.0) for item in invoices_and_sales)
+ # net_amount_prorate = data.get('amount_total', 0.0) * prorate
+ prorate = data.get('amount_total', 0.0) / data.get('sum_amount_total', 0.0)
+ net_amount_prorate = data.get('uang_masuk', 0.0) * prorate
+ self.env['commission.internal.result'].create([{
+ 'commission_internal_id': data['commission_internal_id'],
+ 'commission_internal_line_id': data['commission_internal_line_id'],
+ 'date_doc': data['date'],
+ 'number': data['name'],
+ 'res_name': data['res_name'],
+ 'res_id': data['res_id'],
+ 'name': data['name'],
+ 'salesperson': data['salesperson'],
+ 'totalamt': data['amount_total'],
+ 'uang_masuk_line_id': data['uang_masuk_line_id'],
+ 'uang_masuk_id': data['uang_masuk_id'],
+ 'date_uang_masuk': data['date_uang_masuk'],
+ 'label_uang_masuk': data['label_uang_masuk'],
+ 'nomor_uang_masuk': data['nomor_uang_masuk'],
+ 'uang_masuk': data['uang_masuk'],
+ 'linenetamt_prorate': net_amount_prorate,
+ 'helper1': data['helper1'],
+ 'helper2': data['helper2']
+ }])
+ print(1)
+
+ # this button / method works for train data in July 2025
+ def calculate_commission_internal_from_keyword(self):
+ if not self.commission_internal_line:
+ raise UserError('Commission Internal Line kosong, click Copy GL terlebih dahulu')
+ # execute helper1 for mark keyword
+ self._calculate_exclude_credit()
+ self._calculate_keyword_invoice()
+ self._calculate_keyword_deliveryamt()
+ self._calculate_keyword_payment()
+ self._calculate_keyword_dp()
+ self._calculate_keyword_undefined()
+ # execute helper2 for parse the label into INV/ or SO/ and switch SO to INV if available
+ self._parse_label_helper2()
+
+ def generate_commission_from_generate_ledger(self):
+ if self.commission_internal_line:
+ raise UserError('Harus hapus semua line jika ingin generate ulang')
+ if not self.month:
+ raise UserError('Commission Month harus diisi')
+ if not self.year:
+ raise UserError('Commission Year harus diisi')
+
+ dt_start, dt_end = self._get_period_range(self.year, self.month)
+
+ account_bank_ids = self._get_commission_internal_bank_account_ids()
+ query = [
+ ('move_id.state', '=', 'posted'),
+ ('account_id', 'in', account_bank_ids),
+ ('date', '>=', dt_start),
+ ('date', '<=', dt_end)
+ ]
+ ledgers = self.env['account.move.line'].search(query)
+ count = 0
+ for ledger in ledgers:
+ _logger.info("Read General Ledger Account Move Line %s" % ledger.id)
+ self.env['commission.internal.line'].create([{
+ 'commission_internal_id': self.id,
+ 'date': ledger.date,
+ 'number': ledger.move_id.name,
+ 'account_move_id': ledger.move_id.id,
+ 'account_move_line_id': ledger.id,
+ 'account_id': ledger.account_id.id,
+ 'label': ledger.name,
+ 'debit': ledger.debit,
+ 'credit': ledger.credit,
+ 'balance': ledger.balance
+ }])
+ count += 1
+ _logger.info("Commission Internal Line generated %s" % count)
+
+
+class CommissionInternalLine(models.Model):
+ _name = 'commission.internal.line'
+ _description = 'Line'
+ _order = 'number asc, id'
+
+ commission_internal_id = fields.Many2one('commission.internal', string='Internal Ref', required=True,
+ ondelete='cascade', index=True, copy=False)
+ date = fields.Date(string='Date')
+ number = fields.Char(string='Number')
+ account_move_id = fields.Many2one('account.move', string='Account Move')
+ account_move_line_id = fields.Many2one('account.move.line', string='Account Move Line')
+ account_id = fields.Many2one('account.account', string='Account')
+ label = fields.Char(string='Label')
+ debit = fields.Float(string='Debit')
+ credit = fields.Float(string='Credit')
+ balance = fields.Float(string='Balance')
+ ongkir = fields.Float(string='Ongkir')
+ refund = fields.Float(string='Refund')
+ pph = fields.Float(string='PPh23')
+ others = fields.Float(string='Others')
+ linenetamt = fields.Float(string='Net Amount')
+ dpp = fields.Float(string='DPP')
+ status = fields.Char(string='Status')
+ salespersons = fields.Char(string='Salespersons')
+ invoices = fields.Char(string='Invoices')
+ helper1 = fields.Char(string='Helper1')
+ helper2 = fields.Char(string='Helper2')
+ helper3 = fields.Char(string='Helper3')
+ helper4 = fields.Char(string='Helper4')
+ helper5 = fields.Char(string='Helper5')
+
+
+class CommissionInternalResult(models.Model):
+ _name = 'commission.internal.result'
+ _description = 'Result'
+ _order = 'number asc, id'
+
+ commission_internal_id = fields.Many2one('commission.internal', string='Internal Ref', required=True,
+ ondelete='cascade', index=True, copy=False)
+ commission_internal_line_id = fields.Many2one('commission.internal.line', string='Line Ref')
+ res_name = fields.Char(string='Res Name')
+ res_id = fields.Integer(string='Res ID')
+ date_doc = fields.Date(string='Date Doc')
+ number = fields.Char(string='Number')
+ name = fields.Char(string='Name')
+ salesperson = fields.Char(string='Salesperson')
+ totalamt = fields.Float(string='Total Amount')
+ uang_masuk_line_id = fields.Many2one('account.move.line', string='Uang Masuk Line ID')
+ uang_masuk_id = fields.Many2one('account.move', string='Uang Masuk ID')
+ date_uang_masuk = fields.Date(string='Date Uang Masuk')
+ label_uang_masuk = fields.Char(string='Label Uang Masuk')
+ nomor_uang_masuk = fields.Char(string='Nomor Uang Masuk')
+ uang_masuk = fields.Float(string='Uang Masuk')
+ ongkir = fields.Float(string='Ongkir')
+ refund = fields.Float(string='Refund')
+ pph = fields.Float(string='PPh23')
+ others = fields.Float(string='Others')
+ linenetamt = fields.Float(string='Net Amount')
+ linenetamt_prorate = fields.Float(string='Net Amount Prorate')
+ dpp = fields.Float(string='DPP')
+ status = fields.Char(string='Status')
+ helper1 = fields.Char(string='Helper1')
+ helper2 = fields.Char(string='Helper2')
+ helper3 = fields.Char(string='Helper3')
+ helper4 = fields.Char(string='Helper4')
+ helper5 = fields.Char(string='Helper5')
diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py
index ce94306f..cabcd5d6 100644
--- a/indoteknik_custom/models/coretax_fatur.py
+++ b/indoteknik_custom/models/coretax_fatur.py
@@ -147,7 +147,7 @@ class CoretaxFaktur(models.Model):
subtotal = line_price_subtotal
quantity = line_quantity
total_discount = round(line_discount, 2)
-
+ coretax_id = line.product_uom_id.coretax_id
# Calculate other tax values
otherTaxBase = round(subtotal * (11 / 12), 2) if subtotal else 0
vat_amount = round(otherTaxBase * 0.12, 2)
@@ -159,7 +159,7 @@ class CoretaxFaktur(models.Model):
ET.SubElement(good_service, 'Opt').text = 'A'
ET.SubElement(good_service, 'Code').text = '000000'
ET.SubElement(good_service, 'Name').text = line_name
- ET.SubElement(good_service, 'Unit').text = 'UM.0018'
+ ET.SubElement(good_service, 'Unit').text = coretax_id
# ET.SubElement(good_service, 'Price').text = str(round(line_price_unit, 2)) if line_price_unit else '0'
ET.SubElement(good_service, 'Price').text = str(price_per_unit)
ET.SubElement(good_service, 'Qty').text = str(quantity)
diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py
index 9feea1d1..2562c305 100644
--- a/indoteknik_custom/models/dunning_run.py
+++ b/indoteknik_custom/models/dunning_run.py
@@ -150,4 +150,5 @@ class DunningRunLine(models.Model):
open_amt = fields.Float(string='Open Amount')
due_date = fields.Date(string='Due Date')
payment_term = fields.Many2one('account.payment.term', related='invoice_id.invoice_payment_term_id', string='Payment Term')
+ information_line = fields.Text(string='Information')
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 534d8122..3312e7fd 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -7,6 +7,8 @@ from pytz import timezone, utc
import io
import base64
from odoo.tools import lazy_property
+import socket
+
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
@@ -120,7 +122,13 @@ class PurchaseOrder(models.Model):
string='Show Description',
default=True
)
-
+
+ @staticmethod
+ def is_local_env():
+ hostname = socket.gethostname().lower()
+ keywords = ['andri', 'miqdad', 'fin', 'stephan', 'hafid', 'nathan']
+ return any(keyword in hostname for keyword in keywords)
+
@api.onchange('show_description')
def onchange_show_description(self):
if self.show_description == True:
@@ -1123,7 +1131,7 @@ class PurchaseOrder(models.Model):
if not self.not_update_purchasepricelist:
self.add_product_to_pricelist()
for line in self.order_line:
- if not line.product_id.public_categ_ids:
+ if line.product_id.type == 'product' and not line.product_id.categ_id:
raise UserError("Product %s kategorinya kosong" % line.product_id.name)
if not line.product_id.purchase_ok:
raise UserError("Terdapat barang yang tidak bisa diproses")
@@ -1139,6 +1147,9 @@ class PurchaseOrder(models.Model):
break
if send_email:
+ if self.is_local_env():
+ _logger.warning("📪 Local environment detected — skip sending email reminders.")
+ return
self._send_mail()
if self.revisi_po:
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py
index e6547a88..c6db2174 100644
--- a/indoteknik_custom/models/refund_sale_order.py
+++ b/indoteknik_custom/models/refund_sale_order.py
@@ -326,8 +326,23 @@ class RefundSaleOrder(models.Model):
domain.append(('ref', 'ilike', n))
moves2 = self.env['account.move'].search(domain)
+ moves3 = self.env['account.move']
+ if so_ids:
+ so_names = self.env['sale.order'].browse(so_ids).mapped('name')
+ domain = [
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ('ref', 'ilike', 'uang muka penjualan')
+ ]
+ if so_names:
+ domain += ['|'] * (len(so_names) - 1)
+ for n in so_names:
+ domain.append(('ref', 'ilike', n))
+ moves3 = self.env['account.move'].search(domain)
+
has_moves = bool(moves)
has_moves2 = bool(moves2)
+ has_moves3 = bool(moves3)
has_piutangmdr = bool(piutangmdr)
has_piutangbca = bool(piutangbca)
has_misc = bool(misc)
@@ -349,6 +364,8 @@ class RefundSaleOrder(models.Model):
# sisanya bisa dijumlahkan tanpa konflik
if has_moves2:
amounts.append(sum(moves2.mapped('amount_total_signed')))
+ if has_moves3:
+ amounts.append(sum(moves3.mapped('amount_total_signed')))
if has_piutangbca:
amounts.append(sum(piutangbca.mapped('amount_total_signed')))
if has_piutangmdr:
@@ -573,9 +590,10 @@ class RefundSaleOrder(models.Model):
domain = [
('journal_id', '=', 11),
('state', '=', 'posted'),
- '|',
+ '|', '|',
('ref', 'ilike', 'dp'),
('ref', 'ilike', 'payment'),
+ ('ref', 'ilike', 'uang muka penjualan'),
]
domain += ['|'] * (len(so_names) - 1)
for n in so_names:
@@ -653,6 +671,7 @@ class RefundSaleOrder(models.Model):
('journal_id', '=', 13),
('state', '=', 'posted'),
])
+
moves2 = self.env['account.move']
if so_ids:
so_records = self.env['sale.order'].browse(so_ids)
@@ -668,9 +687,26 @@ class RefundSaleOrder(models.Model):
domain.append(('ref', 'ilike', n))
moves2 = self.env['account.move'].search(domain)
+
+ moves3 = self.env['account.move']
+ if so_ids:
+ so_records = self.env['sale.order'].browse(so_ids)
+ so_names = so_records.mapped('name')
+
+ domain = [
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ('ref', 'ilike', 'uang muka penjualan')
+ ]
+ domain += ['|'] * (len(so_names) - 1)
+ for n in so_names:
+ domain.append(('ref', 'ilike', n))
+
+ moves3 = self.env['account.move'].search(domain)
has_moves = bool(moves)
has_moves2 = bool(moves2)
+ has_moves3 = bool(moves3)
has_piutangmdr = bool(piutangmdr)
has_piutangbca = bool(piutangbca)
has_misc = bool(misc)
@@ -685,6 +721,8 @@ class RefundSaleOrder(models.Model):
amounts.append(sum(moves.mapped('amount_total_signed')))
if has_moves2:
amounts.append(sum(moves2.mapped('amount_total_signed')))
+ if has_moves3:
+ amounts.append(sum(moves3.mapped('amount_total_signed')))
if has_piutangbca:
amounts.append(sum(piutangbca.mapped('amount_total_signed')))
if has_piutangmdr:
@@ -712,39 +750,39 @@ class RefundSaleOrder(models.Model):
if self.sale_order_ids:
self.partner_id = self.sale_order_ids[0].partner_id
- @api.constrains('sale_order_ids')
- def _check_sale_orders_payment(self):
- """ Validasi SO harus punya uang masuk (Journal Uang Muka / Midtrans) """
- for rec in self:
- invalid_orders = []
-
- for so in rec.sale_order_ids:
- # cari journal uang muka
- moves = self.env['account.move'].search([
- ('sale_id', '=', so.id),
- ('journal_id', '=', 11), # Journal Uang Muka
- ('state', '=', 'posted'),
- ])
- piutangbca = self.env['account.move'].search([
- ('ref', 'in', rec.invoice_ids.mapped('name')),
- ('journal_id', '=', 4),
- ('state', '=', 'posted'),
- ])
- piutangmdr = self.env['account.move'].search([
- ('ref', 'in', rec.invoice_ids.mapped('name')),
- ('journal_id', '=', 7),
- ('state', '=', 'posted'),
- ])
-
- if not moves and so.payment_status != 'settlement' and not piutangbca and not piutangmdr:
- invalid_orders.append(so.name)
-
- if invalid_orders:
- raise ValidationError(
- f"Tidak dapat membuat refund untuk SO {', '.join(invalid_orders)} "
- "karena tidak memiliki Record Uang Masuk (Journal Uang Muka/Payment Invoice/Midtrans).\n"
- "Pastikan semua SO yang dipilih sudah memiliki Record pembayaran yang valid."
- )
+ # @api.constrains('sale_order_ids')
+ # def _check_sale_orders_payment(self):
+ # """ Validasi SO harus punya uang masuk (Journal Uang Muka / Midtrans) """
+ # for rec in self:
+ # invalid_orders = []
+
+ # for so in rec.sale_order_ids:
+ # # cari journal uang muka
+ # moves = self.env['account.move'].search([
+ # ('sale_id', '=', so.id),
+ # ('journal_id', '=', 11), # Journal Uang Muka
+ # ('state', '=', 'posted'),
+ # ])
+ # piutangbca = self.env['account.move'].search([
+ # ('ref', 'in', rec.invoice_ids.mapped('name')),
+ # ('journal_id', '=', 4),
+ # ('state', '=', 'posted'),
+ # ])
+ # piutangmdr = self.env['account.move'].search([
+ # ('ref', 'in', rec.invoice_ids.mapped('name')),
+ # ('journal_id', '=', 7),
+ # ('state', '=', 'posted'),
+ # ])
+
+ # if not moves and so.payment_status != 'settlement' and not piutangbca and not piutangmdr:
+ # invalid_orders.append(so.name)
+
+ # if invalid_orders:
+ # raise ValidationError(
+ # f"Tidak dapat membuat refund untuk SO {', '.join(invalid_orders)} "
+ # "karena tidak memiliki Record Uang Masuk (Journal Uang Muka/Payment Invoice/Midtrans).\n"
+ # "Pastikan semua SO yang dipilih sudah memiliki Record pembayaran yang valid."
+ # )
@api.onchange('refund_type')
def _onchange_refund_type(self):
@@ -989,7 +1027,7 @@ class RefundSaleOrder(models.Model):
for rec in self:
if self.env.uid not in allowed_user_ids and not is_fat:
raise UserError("❌ Hanya user yang bersangkutan atau Finance (FAT) yang bisa melakukan penolakan.")
- if rec.status not in ['refund', 'reject']:
+ if rec.status != 'reject':
rec.status = 'reject'
rec.status_payment = 'reject'
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index ef1a5cf4..7f4feb75 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -182,6 +182,7 @@ class ResPartner(models.Model):
payment_history_url = fields.Text(string='Payment History URL')
is_cbd_locked = fields.Boolean("Locked to CBD?", default=False, tracking=True, help="Jika dicentang, maka partner ini terkunci pada payment term CBD karena memiliki invoice yang sudah jatuh tempo lebih dari 30 hari.")
+ cbd_lock_date = fields.Datetime("CBD Lock Date", tracking=True, help="Tanggal ketika partner ini dikunci pada payment term CBD.")
@api.model
@@ -199,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/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 494aeaa2..2ed4046f 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -398,6 +398,48 @@ class SaleOrder(models.Model):
compute="_compute_partner_is_cbd_locked"
)
internal_notes_contact = fields.Text(related='partner_id.comment', string="Internal Notes", readonly=True, help="Internal Notes dari contact utama customer.")
+ is_so_fiktif = fields.Boolean('SO Fiktif?', tracking=3)
+ team_id = fields.Many2one(tracking=True)
+
+
+
+ def action_set_shipping_id(self):
+ for rec in self:
+ bu_pick = self.env['stock.picking'].search([
+ ('state', 'not in', ['cancel']),
+ ('picking_type_id', '=', 30),
+ ('sale_id', '=', rec.id),
+ ('linked_manual_bu_out', '=', False)
+ ])
+ # bu_out = bu_pick_has_out.mapped('linked_manual_bu_out')
+ bu_out = self.env['stock.picking'].search([
+ ('sale_id', '=', rec.id),
+ ('picking_type_id', '=', 29),
+ ('state', 'not in', ['cancel', 'done'])
+ ])
+ bu_pick_has_out = self.env['stock.picking'].search([
+ ('state', 'not in', ['cancel']),
+ ('picking_type_id', '=', 30),
+ ('sale_id', '=', rec.id),
+ ('linked_manual_bu_out.id', '=', bu_out.id),
+ ('linked_manual_bu_out.state', 'not in', ['done', 'cancel'])
+ ])
+ for pick in bu_pick_has_out:
+ linked_out = pick.linked_manual_bu_out
+ if pick.real_shipping_id != rec.real_shipping_id or linked_out.partner_id != rec.partner_shipping_id:
+ pick.real_shipping_id = rec.real_shipping_id
+ pick.partner_id = rec.partner_shipping_id
+ linked_out.partner_id = rec.partner_shipping_id
+ linked_out.real_shipping_id = rec.real_shipping_id
+ _logger.info('Updated bu_pick [%s] and bu_out [%s]', pick.name, linked_out.name)
+
+ for pick in bu_pick:
+ if pick.real_shipping_id != rec.real_shipping_id:
+ pick.real_shipping_id = rec.real_shipping_id
+ pick.partner_id = rec.partner_shipping_id
+ bu_out.partner_id = rec.partner_shipping_id
+ bu_out.real_shipping_id = rec.real_shipping_id
+ _logger.info('Updated bu_pick [%s] without bu_out', pick.name)
def action_open_partial_delivery_wizard(self):
# raise UserError("Fitur ini sedang dalam pengembangan")
@@ -2278,7 +2320,7 @@ class SaleOrder(models.Model):
raise UserError("Terdapat DUPLIKASI data pada Product {}".format(line.product_id.display_name))
def sale_order_approve(self):
- # self.check_duplicate_product()
+ self.check_duplicate_product()
self.check_product_bom()
self.check_credit_limit()
self.check_limit_so_to_invoice()
@@ -2342,27 +2384,38 @@ class SaleOrder(models.Model):
# return self._create_notification_action('Notification',
# 'Terdapat invoice yang telah melewati batas waktu, mohon perbarui pada dokumen Due Extension')
- if not order.with_context(ask_approval=True)._is_request_to_own_team_leader():
- return self._create_notification_action(
- 'Peringatan',
- 'Hanya bisa konfirmasi SO tim Anda.'
- )
if order._requires_approval_margin_leader():
order.approval_status = 'pengajuan2'
+ order.message_post(body="Mengajukan approval ke Pimpinan")
return self._create_approval_notification('Pimpinan')
elif order._requires_approval_margin_manager():
self.check_product_bom()
self.check_credit_limit()
self.check_limit_so_to_invoice()
order.approval_status = 'pengajuan1'
+ order.message_post(body="Mengajukan approval ke Sales Manager")
return self._create_approval_notification('Sales Manager')
elif order._requires_approval_team_sales():
self.check_product_bom()
self.check_credit_limit()
self.check_limit_so_to_invoice()
order.approval_status = 'pengajuan1'
+ order.message_post(body="Mengajukan approval ke Team Sales")
return self._create_approval_notification('Team Sales')
+
+ if not order.with_context(ask_approval=True)._is_request_to_own_team_leader():
+ return self._create_notification_action(
+ 'Peringatan',
+ 'Hanya bisa konfirmasi SO tim Anda.'
+ )
+ user = self.env.user
+ is_sales_admin = user.id in (3401, 20, 3988, 17340)
+ if is_sales_admin:
+ order.approval_status = 'pengajuan1'
+ order.message_post(body="Mengajukan approval ke Sales")
+ return self._create_approval_notification('Sales')
+
raise UserError("Bisa langsung Confirm")
def send_notif_to_salesperson(self, cancel=False):
@@ -2548,7 +2601,7 @@ class SaleOrder(models.Model):
for order in self:
order._validate_delivery_amt()
order._validate_uniform_taxes()
- # order.check_duplicate_product()
+ order.check_duplicate_product()
order.check_product_bom()
order.check_credit_limit()
order.check_limit_so_to_invoice()
@@ -2597,6 +2650,7 @@ class SaleOrder(models.Model):
return self._create_approval_notification('Sales Manager')
elif order._requires_approval_team_sales():
order.approval_status = 'pengajuan1'
+ order.message_post(body="Mengajukan approval ke Team Sales")
return self._create_approval_notification('Team Sales')
order.approval_status = 'approved'
@@ -2703,6 +2757,7 @@ class SaleOrder(models.Model):
def _requires_approval_team_sales(self):
return (
18 <= self.total_percent_margin <= 24
+ # self.total_percent_margin >= 18
and self.env.user.id not in [11, 9, 375] # Eko, Ade, Putra
and not self.env.user.is_sales_manager
and not self.env.user.is_leader
@@ -2716,12 +2771,12 @@ class SaleOrder(models.Model):
if user.is_leader or user.is_sales_manager:
return True
- if user.id in (3401, 20, 3988, 17340): # admin (fida, nabila, ninda)
- raise UserError("Yahaha gabisa confirm so, minta ke sales nya ajah")
-
- if self.env.context.get("ask_approval") and user.id in (3401, 20, 3988):
+ if self.env.context.get("ask_approval") and user.id in (3401, 20, 3988, 17340):
return True
-
+
+ if not self.env.context.get("ask_approval") and user.id in (3401, 20, 3988, 17340): # admin (fida, nabila, ninda, feby)
+ raise UserError("Sales Admin tidak bisa confirm SO, silahkan hubungi Salesperson yang bersangkutan.")
+
salesperson_id = self.user_id.id
approver_id = user.id
team_leader_id = self.team_id.user_id.id
@@ -3373,6 +3428,9 @@ class SaleOrder(models.Model):
# if updated_vals:
# line.write(updated_vals)
+
+ if 'real_shipping_id' in vals:
+ self.action_set_shipping_id()
return res
def button_refund(self):
diff --git a/indoteknik_custom/models/sj_tele.py b/indoteknik_custom/models/sj_tele.py
index 53ba26fc..ed363f59 100644
--- a/indoteknik_custom/models/sj_tele.py
+++ b/indoteknik_custom/models/sj_tele.py
@@ -5,6 +5,7 @@ import json
import logging, subprocess
import time
from collections import OrderedDict
+import socket
_logger = logging.getLogger(__name__)
@@ -20,7 +21,16 @@ class SjTele(models.Model):
date_doc_kirim = fields.Datetime(string='Tanggal Kirim SJ')
is_sent = fields.Boolean(default=False)
+ @staticmethod
+ def is_local_env():
+ hostname = socket.gethostname().lower()
+ keywords = ['andri', 'miqdad', 'fin', 'stephan', 'hafid', 'nathan']
+ return any(keyword in hostname for keyword in keywords)
+
def woi(self):
+ if self.is_local_env():
+ _logger.warning("📪 Local environment detected — skip sending email reminders.")
+ return
bot_mqdd = '8203414501:AAHy_XwiUAVrgRM2EJzW7sZx9npRLITZpb8'
chat_id_mqdd = '-1003087280519'
api_base = f'https://api.telegram.org/bot{bot_mqdd}'
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py
index 8f8ba66f..cac88287 100644
--- a/indoteknik_custom/models/stock_move.py
+++ b/indoteknik_custom/models/stock_move.py
@@ -186,9 +186,19 @@ class StockMoveLine(models.Model):
line_no = fields.Integer('No', default=0)
note = fields.Char('Note')
manufacture = fields.Many2one('x_manufactures', string="Brands", related="product_id.x_manufacture", store=True)
- outstanding_qty = fields.Float(
- string='Outstanding Qty',
- compute='_compute_delivery_line_status',
+ qty_yang_mau_dikirim = fields.Float(
+ string='Qty yang Mau Dikirim',
+ compute='_compute_delivery_status_detail',
+ store=False
+ )
+ qty_terkirim = fields.Float(
+ string='Qty Terkirim',
+ compute='_compute_delivery_status_detail',
+ store=False
+ )
+ qty_gantung = fields.Float(
+ string='Qty Gantung',
+ compute='_compute_delivery_status_detail',
store=False
)
delivery_status = fields.Selection([
@@ -196,46 +206,80 @@ class StockMoveLine(models.Model):
('partial', 'Partial'),
('partial_final', 'Partial Final'),
('full', 'Full'),
- ], string='Delivery Status', compute='_compute_delivery_line_status', store=False)
+ ], string='Delivery Status', compute='_compute_delivery_status_detail', store=False)
@api.depends('qty_done', 'product_uom_qty', 'picking_id.state')
- def _compute_delivery_line_status(self):
- for line in self:
- line.outstanding_qty = 0.0
- line.delivery_status = 'none'
-
- picking = line.picking_id
- if not picking or picking.picking_type_id.code != 'outgoing':
+ def _compute_delivery_status_detail(self):
+ for picking in self:
+ # Default values
+ picking.qty_yang_mau_dikirim = 0.0
+ picking.qty_terkirim = 0.0
+ picking.qty_gantung = 0.0
+ picking.delivery_status = 'none'
+
+ # Hanya berlaku untuk pengiriman (BU/OUT)
+ if picking.picking_id.picking_type_id.code != 'outgoing':
continue
- total_qty = line.move_id.product_uom_qty or 0
- done_qty = line.qty_done or 0
-
- line.outstanding_qty = max(total_qty - done_qty, 0)
+ if picking.picking_id.name not in ['BU/OUT']:
+ continue
- if total_qty == 0:
+ move_lines = picking
+ if not move_lines:
continue
- if done_qty == 0:
- line.delivery_status = 'none'
- elif done_qty > 0:
- has_other_out = self.env['stock.picking'].search_count([
- ('group_id', '=', picking.group_id.id),
- ('name', 'ilike', 'BU/OUT'),
- ('id', '!=', picking.id),
- ('state', '=', 'done'),
- ])
- if has_other_out and done_qty == total_qty:
- line.delivery_status = 'partial_final'
- elif not has_other_out and done_qty >= total_qty:
- line.delivery_status = 'full'
- elif has_other_out and done_qty < total_qty:
- line.delivery_status = 'partial'
- elif done_qty < total_qty:
- line.delivery_status = 'partial'
- else:
- line.delivery_status = 'none'
+ # ======================
+ # HITUNG QTY
+ # ======================
+ total_qty = move_lines.product_uom_qty
+
+ done_qty_total = move_lines.move_id.sale_line_id.qty_delivered
+ order_qty_total = move_lines.move_id.sale_line_id.product_uom_qty
+ gantung_qty_total = order_qty_total - done_qty_total - total_qty
+
+ picking.qty_yang_mau_dikirim = total_qty
+ picking.qty_terkirim = done_qty_total
+ picking.qty_gantung = gantung_qty_total
+
+ # if total_qty == 0:
+ # picking.delivery_status = 'none'
+ # continue
+
+ # if done_qty_total == 0:
+ # picking.delivery_status = 'none'
+ # continue
+
+ # ======================
+ # CEK BU/OUT LAIN (BACKORDER)
+ # ======================
+ # has_other_out = self.env['stock.picking'].search_count([
+ # ('group_id', '=', picking.group_id.id),
+ # ('name', 'ilike', 'BU/OUT'),
+ # ('id', '!=', picking.id),
+ # ('state', 'in', ['assigned', 'waiting', 'confirmed', 'done']),
+ # ])
+
+ # ======================
+ # LOGIKA STATUS
+ # ======================
+ if gantung_qty_total == 0 and done_qty_total == 0:
+ # Semua barang udah terkirim, ga ada picking lain
+ picking.delivery_status = 'full'
+
+ elif gantung_qty_total > 0 and total_qty > 0 and done_qty_total == 0:
+ # Masih ada picking lain dan sisa gantung → proses masih jalan
+ picking.delivery_status = 'partial'
+
+ # elif gantung_qty_total > 0:
+ # # Ini picking terakhir, tapi qty belum full
+ # picking.delivery_status = 'partial_final'
+
+ elif gantung_qty_total == 0 and done_qty_total > 0 and total_qty > 0:
+ # Udah kirim semua tapi masih ada picking lain (rare case)
+ picking.delivery_status = 'partial_final'
+ else:
+ picking.delivery_status = 'none'
# Ambil uom dari stock move
@api.model
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 7f8523a3..e7686b75 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -5,16 +5,16 @@ from collections import defaultdict
from datetime import timedelta, datetime
from datetime import timedelta, datetime as waktu
from itertools import groupby
-import pytz, requests, json, requests
+import pytz, json
from dateutil import parser
import datetime
import hmac
import hashlib
-import base64
import requests
import time
import logging
import re
+import base64
_logger = logging.getLogger(__name__)
@@ -89,6 +89,7 @@ class StockPicking(models.Model):
readonly=True,
related="id",
)
+ sj_documentations = fields.One2many('stock.picking.sj.document','picking_id', string='Dokumentasi SJ (Multi)')
sj_documentation = fields.Binary(string="Dokumentasi Surat Jalan")
paket_documentation = fields.Binary(string="Dokumentasi Paket")
dispatch_documentation = fields.Binary(string="Dokumentasi Dispatch")
@@ -198,6 +199,19 @@ class StockPicking(models.Model):
('partial_final', 'Partial Final'),
('full', 'Full'),
], string='Delivery Status', compute='_compute_delivery_status_detail', store=False)
+ so_num = fields.Char('SO Number', compute='_get_so_num')
+ is_so_fiktif = fields.Boolean('SO Fiktif?', compute='_compute_is_so_fiktif', tracking=3)
+
+ @api.depends('sale_id.is_so_fiktif')
+ def _compute_is_so_fiktif(self):
+ for picking in self:
+ picking.is_so_fiktif = picking.sale_id.is_so_fiktif if picking.sale_id else False
+
+
+ @api.depends('group_id')
+ def _get_so_num(self):
+ for record in self:
+ record.so_num = record.group_id.name
@api.depends('move_line_ids_without_package.qty_done', 'move_line_ids_without_package.product_uom_qty', 'state')
def _compute_delivery_status_detail(self):
@@ -212,6 +226,9 @@ class StockPicking(models.Model):
if picking.picking_type_id.code != 'outgoing':
continue
+ if picking.name not in ['BU/OUT']:
+ continue
+
move_lines = picking.move_line_ids_without_package
if not move_lines:
continue
@@ -240,12 +257,12 @@ class StockPicking(models.Model):
# ======================
# CEK BU/OUT LAIN (BACKORDER)
# ======================
- has_other_out = self.env['stock.picking'].search_count([
- ('group_id', '=', picking.group_id.id),
- ('name', 'ilike', 'BU/OUT'),
- ('id', '!=', picking.id),
- ('state', 'in', ['assigned', 'waiting', 'confirmed', 'done']),
- ])
+ # has_other_out = self.env['stock.picking'].search_count([
+ # ('group_id', '=', picking.group_id.id),
+ # ('name', 'ilike', 'BU/OUT'),
+ # ('id', '!=', picking.id),
+ # ('state', 'in', ['assigned', 'waiting', 'confirmed', 'done']),
+ # ])
# ======================
# LOGIKA STATUS
@@ -457,7 +474,6 @@ class StockPicking(models.Model):
except ValueError:
return False
-
def action_get_kgx_pod(self, shipment=False):
self.ensure_one()
@@ -807,6 +823,37 @@ class StockPicking(models.Model):
picking.envio_cod_value = data.get("cod_value", 0.0)
picking.envio_cod_status = data.get("cod_status")
+ images_data = data.get('images', [])
+ for img in images_data:
+ image_url = img.get('image')
+ if image_url:
+ try:
+ # Download image from URL
+ img_response = requests.get(image_url)
+ img_response.raise_for_status()
+
+ # Encode image to base64
+ image_base64 = base64.b64encode(img_response.content)
+
+ # Create attachment in Odoo
+ attachment = self.env['ir.attachment'].create({
+ 'name': 'Envio Image',
+ 'type': 'binary',
+ 'datas': image_base64,
+ 'res_model': picking._name,
+ 'res_id': picking.id,
+ 'mimetype': 'image/png',
+ })
+
+ # Post log note with attachment
+ picking.message_post(
+ body="Image Envio",
+ attachment_ids=[attachment.id]
+ )
+
+ except Exception as e:
+ picking.message_post(body=f"Gagal ambil image Envio: {str(e)}")
+
# Menyimpan log terbaru
logs = data.get("logs", [])
if logs and isinstance(logs, list) and logs[0]:
@@ -1178,7 +1225,8 @@ class StockPicking(models.Model):
self.sale_id.date_doc_kirim = self.date_doc_kirim
def action_assign(self):
- if self.env.context.get('default_picking_type_id') and ('BU/INPUT' not in self.name or 'BU/PUT' not in self.name):
+ if self.env.context.get('default_picking_type_id') and (
+ 'BU/INPUT' not in self.name or 'BU/PUT' not in self.name):
pickings_to_assign = self.filtered(
lambda p: not (p.sale_id and p.sale_id.hold_outgoing)
)
@@ -1194,18 +1242,15 @@ class StockPicking(models.Model):
return res
-
def ask_approval(self):
# if self.env.user.is_accounting:
# if self.env.user.is_accounting and self.location_id.id == 57 or self.location_id == 57 and self.approval_status in ['pengajuan1', ''] and 'BU/IU' in self.name and self.approval_status == 'pengajuan1':
# raise UserError("Bisa langsung set ke approval logistik")
if self.env.user.is_accounting and self.approval_status == "pengajuan2" and 'BU/IU' in self.name:
raise UserError("Tidak perlu ask approval sudah approval logistik")
- if self.env.user.is_logistic_approver and self.location_id.id == 57 or self.location_id== 57 and self.approval_status == 'pengajuan2' and 'BU/IU' in self.name:
+ if self.env.user.is_logistic_approver and self.location_id.id == 57 or self.location_id == 57 and self.approval_status == 'pengajuan2' and 'BU/IU' in self.name:
raise UserError("Bisa langsung Validate")
-
-
# for calendar distribute only
# if self.is_internal_use:
# stock_move_lines = self.env['stock.move.line'].search([
@@ -1228,7 +1273,6 @@ class StockPicking(models.Model):
raise UserError("Qty tidak boleh 0")
pick.approval_status = 'pengajuan1'
-
def ask_receipt_approval(self):
if self.env.user.is_logistic_approver:
raise UserError('Bisa langsung validate tanpa Ask Receipt')
@@ -1372,6 +1416,8 @@ class StockPicking(models.Model):
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id
users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])])
active_model = self.env.context.get('active_model')
+ if self.is_so_fiktif == True:
+ raise UserError("SO Fiktif tidak bisa di validate")
if self.location_id.id == 47 and self.env.user.id not in users_in_group.mapped(
'id') and self.state_approve_md != 'done':
self.state_approve_md = 'waiting' if self.state_approve_md != 'pending' else 'pending'
@@ -1394,7 +1440,7 @@ class StockPicking(models.Model):
and self.create_date > threshold_datetime
and not self.so_lama):
raise UserError(_("Tidak ada scan koli! Harap periksa kembali."))
-
+
if 'BU/OUT/' in self.name:
self.driver_departure_date = datetime.datetime.utcnow()
@@ -1410,6 +1456,9 @@ class StockPicking(models.Model):
if len(self.check_product_lines) == 0 and 'BU/PICK/' in self.name:
raise UserError(_("Tidak ada Check Product! Harap periksa kembali."))
+ if len(self.check_product_lines) == 0 and 'BU/INPUT/' in self.name:
+ raise UserError(_("Tidak ada Check Product! Harap periksa kembali."))
+
if self.total_koli > self.total_so_koli:
raise UserError(_("Total Koli (%s) dan Total SO Koli (%s) tidak sama! Harap periksa kembali.")
% (self.total_koli, self.t1otal_so_koli))
@@ -1436,13 +1485,16 @@ class StockPicking(models.Model):
# if self.is_internal_use and not self.env.user.is_logistic_approver and self.location_id.id == 57 and self.approval_status == 'pengajuan2':
# raise UserError("Harus di Approve oleh Logistik")
- if self.is_internal_use and self.approval_status in ['pengajuan1', '', False] and 'BU/IU' in self.name and self.is_bu_iu == True:
+ if self.is_internal_use and self.approval_status in ['pengajuan1', '',
+ False] and 'BU/IU' in self.name and self.is_bu_iu == True:
raise UserError("Tidak Bisa Validate, set approval status ke approval logistik terlebih dahhulu")
- if self.is_internal_use and not self.env.user.is_logistic_approver and self.approval_status in ['pengajuan2'] and self.is_bu_iu == True and 'BU/IU' in self.name:
+ if self.is_internal_use and not self.env.user.is_logistic_approver and self.approval_status in [
+ 'pengajuan2'] and self.is_bu_iu == True and 'BU/IU' in self.name:
raise UserError("Harus di Approve oleh Logistik")
- if self.is_internal_use and not self.env.user.is_accounting and self.approval_status in ['pengajuan1', '', False] and self.is_bu_iu == False:
+ if self.is_internal_use and not self.env.user.is_accounting and self.approval_status in ['pengajuan1', '',
+ False] and self.is_bu_iu == False:
raise UserError("Harus di Approve oleh Accounting")
if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver:
@@ -1468,7 +1520,6 @@ class StockPicking(models.Model):
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.date_reserved = current_time
-
# Validate Qty Demand Can't higher than Qty Product
if self.location_dest_id.id == 58 and 'BU/INPUT/' in self.name:
for move in self.move_ids_without_package:
@@ -1490,9 +1541,9 @@ class StockPicking(models.Model):
self.check_koli()
res = super(StockPicking, self).button_validate()
- # Penambahan link PO di Stock Journal untuk Picking BD
+ # Penambahan link PO di Stock Journal
for picking in self:
- if picking.name and 'BD/' in picking.name and picking.purchase_id:
+ if picking.name and picking.purchase_id:
stock_journal = self.env['account.move'].search([
('ref', 'ilike', picking.name + '%'),
('journal_id', '=', 3) # Stock Journal ID
@@ -1551,6 +1602,10 @@ class StockPicking(models.Model):
elif self.tukar_guling_po_id:
self.tukar_guling_po_id.update_doc_state()
+ user = self.env.user
+ if not user.has_group('indoteknik_custom.group_role_logistic') and 'BU/IU' in self.name:
+ raise UserWarning('Validate hnaya bisa di lakukan oleh logistik')
+
return res
def automatic_reserve_product(self):
@@ -1721,6 +1776,15 @@ class StockPicking(models.Model):
'indoteknik_custom.group_role_logistic') and self.picking_type_code == 'outgoing':
raise UserError("Button ini hanya untuk Logistik")
+ if len(self.check_product_lines) >= 1:
+ raise UserError("Tidak Bisa cancel karena sudah di check product")
+
+ if not self.env.user.is_logistic_approver and not self.env.user.has_group('indoteknik_custom.group_role_logistic'):
+ for picking in self:
+ if picking.name and ('BU/PICK' in picking.name or 'BU/OUT' in picking.name or 'BU/ORT' in picking.name or 'BU/SRT' in picking.name):
+ if picking.state not in ['cancel']:
+ raise UserError("Button ini hanya untuk Logistik")
+
res = super(StockPicking, self).action_cancel()
return res
@@ -1869,7 +1933,8 @@ class StockPicking(models.Model):
'name': move_line.product_id.name,
'code': move_line.product_id.default_code,
'qty': move_line.qty_done,
- 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', move_line.product_id.product_tmpl_id.id),
+ 'image': self.env['ir.attachment'].api_image('product.template', 'image_128',
+ move_line.product_id.product_tmpl_id.id),
})
response = {
@@ -2235,7 +2300,6 @@ class CheckProduct(models.Model):
_order = 'picking_id, id'
_inherit = ['barcodes.barcode_events_mixin']
-
picking_id = fields.Many2one(
'stock.picking',
string='Picking Reference',
@@ -2688,8 +2752,6 @@ class ScanKoli(models.Model):
out_move.qty_done += qty_to_assign
qty_koli -= qty_to_assign
-
-
def _reset_qty_done_if_no_scan(self, picking_id):
product_bu_pick = self.env['stock.move.line'].search([('picking_id', '=', picking_id)])
@@ -2748,4 +2810,15 @@ class WarningModalWizard(models.TransientModel):
def action_continue(self):
if self.picking_id:
return self.picking_id.with_context(skip_koli_check=True).button_validate()
- return {'type': 'ir.actions.act_window_close'} \ No newline at end of file
+ return {'type': 'ir.actions.act_window_close'}
+
+
+class StockPickingSjDocument(models.Model):
+ _name = 'stock.picking.sj.document'
+ _description = 'Dokumentasi Surat Jalan (Multi)'
+ _order = 'sequence, id'
+ _rec_name = 'id'
+
+ picking_id = fields.Many2one('stock.picking', required=True, ondelete='cascade')
+ image = fields.Binary('Gambar', required=True, attachment=True)
+ sequence = fields.Integer('Urutan', default=10) \ No newline at end of file
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py
index 99a74505..aa116ce3 100644
--- a/indoteknik_custom/models/tukar_guling.py
+++ b/indoteknik_custom/models/tukar_guling.py
@@ -737,14 +737,18 @@ class TukarGuling(models.Model):
if mapping_koli and record.operations.picking_type_id.id == 29:
for prod in mapping_koli.mapped('product_id'):
qty_total = sum(mk.qty_return for mk in mapping_koli.filtered(lambda m: m.product_id == prod))
- move = bu_out.move_lines.filtered(lambda m: m.product_id == prod)
- if not move:
- raise UserError(f"Move BU/OUT tidak ditemukan untuk produk {prod.display_name}")
- srt_return_lines.append((0, 0, {
- 'product_id': prod.id,
- 'quantity': qty_total,
- 'move_id': move.id,
- }))
+
+ move_lines = bu_out.move_line_ids.filtered(
+ lambda ml: ml.product_id == prod and ml.qty_done > 0 and not ml.package_id
+ )
+
+ for ml in move_lines:
+ srt_return_lines.append((0, 0, {
+ 'product_id': ml.product_id.id,
+ 'quantity': ml.qty_done,
+ 'move_id': ml.move_id.id,
+ }))
+
_logger.info(f"📟 SRT line: {prod.display_name} | qty={qty_total}")
elif not mapping_koli and record.operations.picking_type_id.id == 29:
diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py
index 2a5ca3dd..739898a1 100644
--- a/indoteknik_custom/models/tukar_guling_po.py
+++ b/indoteknik_custom/models/tukar_guling_po.py
@@ -366,8 +366,8 @@ class TukarGulingPO(models.Model):
# if bu_put:
# raise UserError("❌ Tidak bisa retur BU/INPUT karena BU/PUT sudah Done!")
- if self.operations.picking_type_id.id == 28 and tipe == 'tukar_guling':
- raise UserError("❌ BU/INPUT tidak boleh di retur tukar guling")
+ # if self.operations.picking_type_id.id == 28 and tipe == 'tukar_guling':
+ # raise UserError("❌ BU/INPUT tidak boleh di retur tukar guling")
# if self.operations.picking_type_id.id != 28:
# if self._is_already_returned(self.operations):
diff --git a/indoteknik_custom/models/uom_uom.py b/indoteknik_custom/models/uom_uom.py
new file mode 100644
index 00000000..32e53d73
--- /dev/null
+++ b/indoteknik_custom/models/uom_uom.py
@@ -0,0 +1,6 @@
+from odoo import fields, models, api, _
+
+class Uom(models.Model):
+ _inherit = 'uom.uom'
+
+ coretax_id = fields.Char(string='Coretax ID')
diff --git a/indoteknik_custom/report/purchase_report.xml b/indoteknik_custom/report/purchase_report.xml
index 23fa4d52..208e6472 100644
--- a/indoteknik_custom/report/purchase_report.xml
+++ b/indoteknik_custom/report/purchase_report.xml
@@ -97,7 +97,8 @@
<!-- TEKS -->
<div style="display:flex; flex-direction:column; flex:1;">
<span style="font-weight:bold; margin-bottom:2px;">
- <t t-esc="line_index + 1"/>. <t t-esc="line.product_id.display_name"/>
+ <t t-esc="line_index + 1"/>. <t t-esc="line.name"/>
+ <!-- <t t-esc="line_index + 1"/>. <t t-esc="line.product_id.display_name"/> -->
</span>
</div>
</td>
@@ -130,7 +131,7 @@
</tr>
<!-- WEBSITE DESCRIPTION -->
- <t t-if="line.show_description">
+ <t t-if="line.show_description == True">
<tr t-attf-style="background-color: #{ '#fef5f5' if line_index % 2 == 0 else '#fffafa' }; ">
<td colspan="6" style="padding: 10px 14px; font-size:10px; line-height:1.3; font-style:italic; color:#555; border-left:1px solid #ccc; border-right:1px solid #ccc; border-bottom:1px solid #ccc;">
<div t-raw="line.product_id.website_description"/>
diff --git a/indoteknik_custom/report/report_tutup_tempo.xml b/indoteknik_custom/report/report_tutup_tempo.xml
index 1aa1367d..5fa5552f 100644
--- a/indoteknik_custom/report/report_tutup_tempo.xml
+++ b/indoteknik_custom/report/report_tutup_tempo.xml
@@ -91,19 +91,72 @@
Berdasarkan catatan kami, pembayaran atas beberapa invoice yang telah melewati batas waktu 30 (tiga puluh) hari adalah sebagai berikut:
</p>
- <table class="table table-sm" style="font-size:13px; border:1px solid #000; margin-top:16px; margin-bottom:16px;">
+ <table class="table table-sm o_main_table"
+ style="font-size:13px; border:1px solid #000; border-collapse: collapse; width:100%; table-layout: fixed;">
+
<thead style="background:#f5f5f5;">
<tr>
- <th style="border:1px solid #000; padding:4px; font-weight: bold;">Invoice</th>
- <th style="border:1px solid #000; padding:4px; font-weight: bold;">Due Date</th>
- <th style="border:1px solid #000; padding:4px; font-weight: bold;" class="text-center">Day to Due</th>
+ <th style="border:1px solid #000; padding:4px; width:5%; font-weight: bold;" class="text-center">No.</th>
+ <th style="border:1px solid #000; padding:4px; width:16%; font-weight: bold;">Invoice Number</th>
+ <th style="border:1px solid #000; padding:4px; width:10%; font-weight: bold;">Invoice Date</th>
+ <th style="border:1px solid #000; padding:4px; width:10%; font-weight: bold;">Due Date</th>
+ <th style="border:1px solid #000; padding:4px; width:6%; font-weight: bold;" class="text-center">Day to Due</th>
+ <th style="border:1px solid #000; padding:4px; width:16%; font-weight: bold;">Reference</th>
+ <th style="border:1px solid #000; padding:4px; width:17%; font-weight: bold;" class="text-right">Amount Due</th>
+ <th style="border:1px solid #000; padding:4px; width:11%; font-weight: bold;">Payment Terms</th>
</tr>
</thead>
<tbody>
- <tr t-foreach="selected_lines" t-as="line">
- <td style="border:1px solid #000; padding:4px;"><t t-esc="line.invoice_number"/></td>
- <td style="border:1px solid #000; padding:4px;"><t t-esc="line.invoice_date_due and line.invoice_date_due.strftime('%d-%m-%Y')"/></td>
- <td style="border:1px solid #000; padding:4px;" class="text-center"><t t-esc="line.new_invoice_day_to_due"/></td>
+ <tr t-foreach="doc.line_ids.filtered(lambda l: l.selected)" t-as="line">
+
+ <!-- Nomor Urut -->
+ <td style="border:1px solid #000; padding:4px; text-align:center;">
+ <t t-esc="line.sort or '-'"/>
+ </td>
+
+ <!-- Invoice Number -->
+ <td style="border:1px solid #000; padding:4px; word-wrap: break-word;">
+ <t t-esc="line.invoice_number or '-'"/>
+ </td>
+
+ <!-- Invoice Date -->
+ <td style="border:1px solid #000; padding:4px;">
+ <t t-esc="line.invoice_date and line.invoice_date.strftime('%d-%m-%Y') or '-'"/>
+ </td>
+
+ <!-- Due Date -->
+ <td style="border:1px solid #000; padding:4px;">
+ <t t-esc="line.invoice_date_due and line.invoice_date_due.strftime('%d-%m-%Y') or '-'"/>
+ </td>
+
+ <!-- Day to Due -->
+ <td style="border:1px solid #000; padding:4px; text-align:center;">
+ <t t-esc="line.new_invoice_day_to_due or '-'"/>
+ </td>
+
+ <!-- Reference -->
+ <td style="border:1px solid #000; padding:4px; word-wrap: break-word;">
+ <t t-esc="line.ref or '-'"/>
+ </td>
+
+ <!-- Amount Due -->
+ <td style="border:1px solid #000; padding:4px; text-align:right;">
+ Rp. <t t-esc="'{:,.0f}'.format(line.amount_residual).replace(',', '.')"/>
+ </td>
+
+ <!-- Payment Terms -->
+ <td style="border:1px solid #000; padding:4px; word-wrap: break-word;">
+ <t t-esc="line.payment_term_id.name or '-'"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="5" class="text-left" style="border:1px solid #000; padding:4px; word-wrap: break-word; white-space: normal; font-weight: bold;">
+ GRAND TOTAL INVOICE YANG BELUM DIBAYAR DAN TELAH JATUH TEMPO
+ </td>
+ <td colspan="3" class="text-right" style="border:1px solid #000; padding:4px; word-wrap: break-word; white-space: normal; font-weight: bold;">
+ Rp. <t t-esc="'{:,.0f}'.format(doc.grand_total).replace(',', '.')"/>
+ (<t t-esc="doc.grand_total_text or '-'"/>)
+ </td>
</tr>
</tbody>
</table>
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 90aa634c..7e1051bc 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -164,6 +164,9 @@ access_purchase_order_unlock_wizard,access.purchase.order.unlock.wizard,model_pu
access_sales_order_koli,access.sales.order.koli,model_sales_order_koli,,1,1,1,1
access_stock_backorder_confirmation,access.stock.backorder.confirmation,model_stock_backorder_confirmation,,1,1,1,1
access_warning_modal_wizard,access.warning.modal.wizard,model_warning_modal_wizard,,1,1,1,1
+access_commission_internal,access.commission.internal,model_commission_internal,,1,1,1,1
+access_commission_internal_line,access.commission.internal.line,model_commission_internal_line,,1,1,1,1
+access_commission_internal_result,access.commission.internal.result,model_commission_internal_result,,1,1,1,1
access_User_pengajuan_tempo_line,access.user.pengajuan.tempo.line,model_user_pengajuan_tempo_line,,1,1,1,1
access_user_pengajuan_tempo,access.user.pengajuan.tempo,model_user_pengajuan_tempo,,1,1,1,1
@@ -213,4 +216,5 @@ access_sj_tele,access.sj.tele,model_sj_tele,base.group_system,1,1,1,1
access_sourcing_job_order,access.sourcing_job_order,model_sourcing_job_order,base.group_system,1,1,1,1
access_sourcing_job_order_line_user,sourcing.job.order.line,model_sourcing_job_order_line,base.group_user,1,1,1,1
access_sourcing_reject_wizard,sourcing.reject.wizard,model_sourcing_reject_wizard,base.group_user,1,1,1,1
-access_wizard_export_sjo_to_so,wizard.export.sjo.to.so,model_wizard_export_sjo_to_so,base.group_user,1,1,1,1 \ No newline at end of file
+access_wizard_export_sjo_to_so,wizard.export.sjo.to.so,model_wizard_export_sjo_to_so,base.group_user,1,1,1,1
+access_stock_picking_sj_document,stock.picking.sj.document,model_stock_picking_sj_document,base.group_user,1,1,1,1
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>
diff --git a/indoteknik_custom/views/advance_payment_request.xml b/indoteknik_custom/views/advance_payment_request.xml
index 2a8e1318..4e73bb28 100644
--- a/indoteknik_custom/views/advance_payment_request.xml
+++ b/indoteknik_custom/views/advance_payment_request.xml
@@ -4,7 +4,7 @@
<field name="name">advance.payment.request.form</field>
<field name="model">advance.payment.request</field>
<field name="arch" type="xml">
- <form string="Advance Payment Request &amp; Reimburse">
+ <form string="Advance Payment Request &amp; Reimburse" duplicate="0">
<header>
<button name="action_realisasi_pum"
type="object"
@@ -85,7 +85,7 @@
<group col="2">
<group string=" ">
<field name="type_request" attrs="{'readonly': [('status', '=', 'approved')]}"/>
- <field name="is_represented" attrs="{'readonly': [('status', '=', 'approved')], 'invisible': [('type_request', '=', 'reimburse')]}"/>
+ <field name="is_represented" attrs="{'readonly': [('status', '=', 'approved')]}"/>
<field name="applicant_name" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/>
<field name="position_type" force_save="1" readonly="1"/>
<field name="nominal" colspan="2" attrs="{'readonly': ['|', ('status', '=', 'approved'), ('type_request', '=', 'reimburse')]}" force_save="1"/>
@@ -214,11 +214,26 @@
</field>
</record>
+ <record id="view_advance_payment_request_filter" model="ir.ui.view">
+ <field name="name">advance.payment.request.filter</field>
+ <field name="model">advance.payment.request</field>
+ <field name="arch" type="xml">
+ <search string="Search APR &amp; Reimburse">
+ <filter string="My Requests" name="my_requests" domain="[('applicant_name','=',uid)]"/>
+ <separator/>
+ <filter string="PUM" name="filter_pum" domain="[('type_request','=','pum')]"/>
+ <filter string="Reimburse" name="filter_reimburse" domain="[('type_request','=','reimburse')]"/>
+ </search>
+ </field>
+ </record>
+
<record id="action_advance_payment_request" model="ir.actions.act_window">
<field name="name">Pengajuan Uang Muka &amp; Reimburse</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">advance.payment.request</field>
<field name="view_mode">tree,form</field>
+ <field name="context">{'search_default_my_requests': 1}</field>
+ <field name="search_view_id" ref="view_advance_payment_request_filter"/>
</record>
<menuitem id="menu_advance_payment_request_acct"
diff --git a/indoteknik_custom/views/advance_payment_settlement.xml b/indoteknik_custom/views/advance_payment_settlement.xml
index 1a9d7908..050e3933 100644
--- a/indoteknik_custom/views/advance_payment_settlement.xml
+++ b/indoteknik_custom/views/advance_payment_settlement.xml
@@ -3,7 +3,7 @@
<field name="name">advance.payment.settlement.form</field>
<field name="model">advance.payment.settlement</field>
<field name="arch" type="xml">
- <form string="Advance Payment Settlement">
+ <form string="Advance Payment Settlement" duplicate="0">
<header>
<button name="action_cab"
type="object"
@@ -47,7 +47,9 @@
<field name="title" required="1"/>
<field name="goals" required="1"/>
<field name="related" required="1"/>
- <field name="note_approval" required="1"/>
+ <field name="note_approval"/>
+ <p style="font-size: 11px; color: grey; font-style: italic">*Lengkapi keterangan berikut selaras dengan realisasi yang dilakukan (sesuai dengan format surat yang ada)</p>
+ <br/><br/>
<field name="lot_of_attachment"/>
<field name="approved_by" readonly="1"/>
<field name="applicant_name" readonly="1"/>
diff --git a/indoteknik_custom/views/commission_internal.xml b/indoteknik_custom/views/commission_internal.xml
new file mode 100644
index 00000000..2f3db5b0
--- /dev/null
+++ b/indoteknik_custom/views/commission_internal.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="commission_internal_tree" model="ir.ui.view">
+ <field name="name">commission.internal.tree</field>
+ <field name="model">commission.internal</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="number"/>
+ <field name="date_doc"/>
+ <field name="month"/>
+ <field name="year"/>
+ <field name="description"/>
+ <field name="comment"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="commission_internal_form" model="ir.ui.view">
+ <field name="name">commission.internal.form</field>
+ <field name="model">commission.internal</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet string="Header">
+ <div class="oe_button_box" name="button_box"/>
+ <group>
+ <group>
+ <field name="number"/>
+ <field name="date_doc"/>
+ <field name="description"/>
+ <field name="comment" readonly="1"/>
+ </group>
+ <group>
+ <field name="month"/>
+ <field name="year"/>
+ <div>
+ <button name="generate_commission_from_generate_ledger"
+ string="Copy GL"
+ type="object"
+ />
+ </div>
+ <div>
+ <button name="calculate_commission_internal_from_keyword"
+ string="Calculate"
+ type="object"
+ />
+ </div>
+ <div>
+ <button name="calculate_commission_internal_result"
+ string="Result"
+ type="object"
+ />
+ </div>
+ </group>
+ </group>
+ <notebook>
+ <page id="commission_internal_line_tab" string="Lines">
+ <field name="commission_internal_line"/>
+ </page>
+ <page id="commission_internal_result_tab" string="Result">
+ <field name="commission_internal_result"/>
+ </page>
+ </notebook>
+ </sheet>
+ <div class="oe_chatter">
+ <field name="message_follower_ids" widget="mail_followers"/>
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
+ </form>
+ </field>
+ </record>
+
+ <record id="commission_internal_line_tree" model="ir.ui.view">
+ <field name="name">commission.internal.line.tree</field>
+ <field name="model">commission.internal.line</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="date"/>
+ <field name="number"/>
+ <field name="account_move_id" optional="hide"/>
+ <field name="account_move_line_id" optional="hide"/>
+ <field name="label"/>
+ <field name="debit"/>
+ <field name="credit"/>
+ <field name="balance"/>
+ <field name="ongkir"/>
+ <field name="refund"/>
+ <field name="pph"/>
+ <field name="others"/>
+ <field name="linenetamt"/>
+ <field name="dpp"/>
+ <field name="status"/>
+ <field name="helper1" optional="hide"/>
+ <field name="helper2" optional="hide"/>
+ <field name="helper3" optional="hide"/>
+ <field name="helper4" optional="hide"/>
+ <field name="helper5" optional="hide"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="commission_internal_result_tree" model="ir.ui.view">
+ <field name="name">commission.internal.result.tree</field>
+ <field name="model">commission.internal.result</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="date_doc"/>
+ <field name="number"/>
+ <field name="res_name" optional="hide"/>
+ <field name="res_id" optional="hide"/>
+ <field name="name"/>
+ <field name="salesperson"/>
+ <field name="totalamt"/>
+ <field name="uang_masuk_line_id" optional="hide"/>
+ <field name="uang_masuk_id" optional="hide"/>
+ <field name="date_uang_masuk"/>
+ <field name="label_uang_masuk"/>
+ <field name="nomor_uang_masuk"/>
+ <field name="uang_masuk"/>
+ <field name="ongkir"/>
+ <field name="refund"/>
+ <field name="pph"/>
+ <field name="others"/>
+ <field name="linenetamt"/>
+ <field name="linenetamt_prorate"/>
+ <field name="dpp"/>
+ <field name="status" optional="hide"/>
+ <field name="helper1" optional="hide"/>
+ <field name="helper2" optional="hide"/>
+ <field name="helper3" optional="hide"/>
+ <field name="helper4" optional="hide"/>
+ <field name="helper5" optional="hide"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_commission_internal_filter" model="ir.ui.view">
+ <field name="name">commission.internal.list.select</field>
+ <field name="model">commission.internal</field>
+ <field name="priority" eval="15"/>
+ <field name="arch" type="xml">
+ <search string="Search Commission Internal">
+ <field name="number"/>
+ </search>
+ </field>
+ </record>
+
+ <record id="commission_internal_action" model="ir.actions.act_window">
+ <field name="name">Commission Internal</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">commission.internal</field>
+ <field name="search_view_id" ref="view_commission_internal_filter"/>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem id="menu_commission_internal"
+ name="Commission Internal"
+ action="commission_internal_action"
+ parent="account.menu_finance_reports"
+ sequence="251"/>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml
index 51377f78..911a372d 100644
--- a/indoteknik_custom/views/dunning_run.xml
+++ b/indoteknik_custom/views/dunning_run.xml
@@ -25,6 +25,7 @@
<field name="arch" type="xml">
<tree>
<field name="partner_id"/>
+ <field name="information_line"/>
<field name="reference"/>
<field name="invoice_id"/>
<field name="date_invoice"/>
diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml
index 543f1fd1..31ea4261 100644
--- a/indoteknik_custom/views/ir_sequence.xml
+++ b/indoteknik_custom/views/ir_sequence.xml
@@ -234,6 +234,7 @@
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
+ <field name="use_date_range" eval="True"/>
<field name="active">True</field>
</record>
@@ -244,6 +245,7 @@
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
+ <field name="use_date_range" eval="True"/>
<field name="active">True</field>
</record>
@@ -254,6 +256,7 @@
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
+ <field name="use_date_range" eval="True"/>
<field name="active">True</field>
</record>
diff --git a/indoteknik_custom/views/refund_sale_order.xml b/indoteknik_custom/views/refund_sale_order.xml
index afa7c1cb..fbe17093 100644
--- a/indoteknik_custom/views/refund_sale_order.xml
+++ b/indoteknik_custom/views/refund_sale_order.xml
@@ -57,7 +57,7 @@
<button name="action_trigger_cancel"
type="object"
string="Cancel"
- attrs="{'invisible': ['|', ('status_payment', '!=', 'pending'), ('status', 'in', ['reject', 'refund'])]}" />
+ attrs="{'invisible': ['|', ('status_payment', '!=', 'pending'), ('status', '=', 'reject')]}" />
<button name="action_confirm_refund"
type="object"
string="Confirm Payment"
@@ -257,7 +257,7 @@
</group>
</page>
- <page string="Cancel Reason" attrs="{'invisible': [('status', '=', 'refund')]}">
+ <page string="Cancel Reason" attrs="{'invisible': [('status_payment', '=', 'done')]}">
<group>
<field name="reason_reject"/>
</group>
diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml
index 72751187..8378bf34 100644
--- a/indoteknik_custom/views/res_partner.xml
+++ b/indoteknik_custom/views/res_partner.xml
@@ -23,6 +23,7 @@
<field name="property_payment_term_id" position="after">
<field name="previous_payment_term_id" readonly="1"/>
<field name="is_cbd_locked" readonly="1"/>
+ <field name="cbd_lock_date" readonly="1"/>
<field name="user_payment_terms_sales" readonly="1"/>
<field name="date_payment_terms_sales" readonly="1"/>
</field>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index a540caa7..23fbe155 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -55,6 +55,10 @@
attrs="{'invisible':['|', ('partner_is_cbd_locked','=',False), ('state', 'not in', ['draft', 'cancel'])]}">
<strong>Warning!</strong> Payment Terms Customer terkunci menjadi <b>Cash Before Delivery (C.B.D.)</b> karena ada invoice telah jatuh tempo <b>30 hari</b>. Silakan ajukan <b>Approval Payment Term</b> untuk membuka kunci.
</div>
+ <widget name="web_ribbon"
+ title="FIKTIF"
+ bg_color="bg-danger"
+ attrs="{'invisible': [('is_so_fiktif', '=', False)]}"/>
</xpath>
<div class="oe_button_box" name="button_box">
<field name="advance_payment_move_ids" invisible="1"/>
@@ -130,6 +134,7 @@
</field>
<field name="approval_status" position="after">
<field name="notes"/>
+ <field name="is_so_fiktif"/>
</field>
<field name="source_id" position="attributes">
<attribute name="invisible">1</attribute>
@@ -142,6 +147,10 @@
<field name="helper_by_id" readonly="1" />
<field name="compute_fullfillment" invisible="1" />
</field>
+ <xpath expr="//field[@name='team_id']" position="attributes">
+ <attribute name="attrs">{'readonly': [('state', 'in', ['sale', 'done'])]}</attribute>
+ </xpath>
+
<field name="tag_ids" position="after">
<!-- <field name="eta_date_start"/> -->
<t t-esc="' to '"/>
@@ -482,6 +491,7 @@
<field name="pareto_status" optional="hide"/>
<field name="shipping_method_picking" optional="hide"/>
<field name="hold_outgoing" optional="hide"/>
+ <field name="is_so_fiktif" optional="hide" readonly="1"/>
</field>
</field>
</record>
@@ -498,8 +508,8 @@
<field name="date_kirim_ril"/>
<field name="date_driver_departure"/>
<field name="date_driver_arrival"/>
- <field name="payment_state_custom" widget="badge"
- decoration-danger="payment_state_custom == 'unpaid'"
+ <field name="payment_state_custom" widget="badge"
+ decoration-danger="payment_state_custom == 'unpaid'"
decoration-success="payment_state_custom == 'paid'"
decoration-warning="payment_state_custom == 'partial'" optional="hide"/>
<field name="unreserved_percent" widget="percentpie" string="Unreserved" optional="hide"/>
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 050fc819..bad85963 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -23,6 +23,7 @@
<field name="state_packing" widget="badge" decoration-success="state_packing == 'packing_done'"
decoration-danger="state_packing == 'not_packing'" optional="hide"/>
<field name="final_seq"/>
+ <field name="is_so_fiktif" optional="hide" readonly="1"/>
<field name="state_approve_md" widget="badge" decoration-success="state_approve_md == 'done'"
decoration-warning="state_approve_md == 'pending'" optional="hide"/>
<!-- <field name="countdown_hours" optional="hide"/>
@@ -115,6 +116,7 @@
position="after">
<field name="product_image" widget="image"
style="height:128px;width:128px;" readonly="1"/>
+
</xpath> -->
<field name="backorder_id" position="after">
<field name="select_shipping_option_so"/>
@@ -147,7 +149,7 @@
<attribute name="attrs">{'readonly': [('parent.picking_type_code', '=', 'incoming')]}</attribute>
</field> -->
<field name="date_done" position="after">
- <field name="arrival_time"/>
+ <field name="arrival_time" attrs="{'invisible': [('picking_type_id', 'in', [29,30])]}"/>
</field>
<field name="scheduled_date" position="attributes">
<attribute name="readonly">1</attribute>
@@ -162,11 +164,13 @@
<field name="origin" position="after">
<!-- <field name="show_state_approve_md" invisible="1" optional="hide"/>-->
- <field name="state_approve_md" widget="badge"/>
+ <field name="state_approve_md" widget="badge"
+ attrs="{'invisible': [('picking_type_id', 'in', [29,30])]}"/>
<field name="purchase_id"/>
<field name="sale_order"/>
<field name="invoice_status"/>
- <field name="is_bu_iu" />
+ <field name="is_bu_iu"/>
+ <field name="is_so_fiktif" readonly="1"/>
<field name="approval_status" attrs="{'invisible': [('is_bu_iu', '=', False)]}"/>
<field name="date_doc_kirim" attrs="{'readonly':[('invoice_status', '=', 'invoiced')]}"/>
<field name="summary_qty_operation"/>
@@ -180,6 +184,7 @@
'required': [['is_internal_use', '=', True]]
}"
/>
+ <field name="so_num" attrs="{'invisible': [('picking_type_id', 'not in', [29,30,73,74])]}"/>
</field>
<field name="group_id" position="before">
<field name="date_reserved"/>
@@ -248,6 +253,16 @@
attrs="{'invisible': [('select_shipping_option_so', '=', 'biteship')]}"/>
<field name="driver_id"/>
<field name='sj_return_date'/>
+ <field name="sj_documentations" context="{'default_picking_id': active_id}">
+ <tree editable="bottom">
+ <field name="image" widget="image" options="{'size':[128,128]}"/>
+ </tree>
+ <form>
+ <group>
+ <field name="image" widget="image" options="{'size':[512,512]}"/>
+ </group>
+ </form>
+ </field>
<field name="sj_documentation" widget="image"/>
<field name="paket_documentation" widget="image"/>
<field name="dispatch_documentation" widget="image"/>
@@ -329,6 +344,22 @@
</field>
</record>
+ <record id="view_picking_form_inherit_ribbon" model="ir.ui.view">
+ <field name="name">stock.picking.form.ribbon</field>
+ <field name="model">stock.picking</field>
+ <field name="inherit_id" ref="stock.view_picking_form"/>
+ <field name="arch" type="xml">
+ <!-- Sisipkan sebelum elemen dengan class oe_title -->
+ <xpath expr="//sheet/div[@class='oe_title']" position="before">
+ <widget name="web_ribbon"
+ title="FIKTIF"
+ bg_color="bg-danger"
+ attrs="{'invisible': [('is_so_fiktif', '=', False)]}"/>
+ </xpath>
+ </field>
+ </record>
+
+
<record id="scan_koli_tree" model="ir.ui.view">
<field name="name">scan.koli.tree</field>
<field name="model">scan.koli</field>
@@ -398,8 +429,11 @@
decoration-danger="qty_done&gt;product_uom_qty and state!='done' and parent.picking_type_code != 'incoming'"
decoration-success="qty_done==product_uom_qty and state!='done' and not result_package_id">
<field name="note" placeholder="Add a note here"/>
- <field name="outstanding_qty"/>
- <field name="delivery_status" widget="badge" options="{'colors': {'full': 'success', 'partial': 'warning', 'partial_final': 'danger'}}"/>
+ <field name="qty_yang_mau_dikirim"/>
+ <field name="qty_terkirim"/>
+ <field name="qty_gantung"/>
+ <field name="delivery_status" widget="badge"
+ options="{'colors': {'full': 'success', 'partial': 'warning', 'partial_final': 'danger'}}"/>
</tree>
</field>
</record>
@@ -423,7 +457,9 @@
<form string="Peringatan Koli Belum Diperiksa">
<sheet>
<div class="oe_title">
- <h2><span>⚠️ Perhatian!</span></h2>
+ <h2>
+ <span>⚠️ Perhatian!</span>
+ </h2>
</div>
<group>
<field name="message" readonly="1" nolabel="1" widget="text"/>
diff --git a/indoteknik_custom/views/uom_uom.xml b/indoteknik_custom/views/uom_uom.xml
new file mode 100644
index 00000000..a7fb55e5
--- /dev/null
+++ b/indoteknik_custom/views/uom_uom.xml
@@ -0,0 +1,14 @@
+<odoo>
+ <data>
+ <record id="uom_form_view_inherit" model="ir.ui.view">
+ <field name="name">Uom</field>
+ <field name="model">uom.uom</field>
+ <field name="inherit_id" ref="uom.product_uom_form_view"/>
+ <field name="arch" type="xml">
+ <field name="rounding" position="after">
+ <field name="coretax_id"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</odoo> \ No newline at end of file