summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-10-31 13:49:23 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-10-31 13:49:23 +0700
commitd8c12d085edbd81d974555780b16421c7b155f7f (patch)
treece8993a2fe4ccda62827dceb10b7acc097babc9c
parent4588b8df03628821dce6eb6029ac4bcd5065aba8 (diff)
<iman> update pengajuan tempo final
-rw-r--r--indoteknik_api/controllers/api_v1/partner.py225
-rwxr-xr-xindoteknik_custom/__manifest__.py2
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/pengajuan_tempo.py11
-rw-r--r--indoteknik_custom/models/res_partner.py103
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo.py148
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_line.py14
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_request.py184
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv4
-rw-r--r--indoteknik_custom/views/res_partner.xml129
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo.xml129
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo_line.xml42
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo_request.xml67
13 files changed, 966 insertions, 95 deletions
diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py
index a7925a02..27ba186f 100644
--- a/indoteknik_api/controllers/api_v1/partner.py
+++ b/indoteknik_api/controllers/api_v1/partner.py
@@ -2,6 +2,9 @@ from .. import controller
from odoo import http
from odoo.http import request
+import json
+import base64
+import mimetypes
class Partner(controller.Controller):
_name = 'res.partner'
@@ -226,8 +229,228 @@ class Partner(controller.Controller):
'amount_due': result_tempo,
'remaining_limit': remaining_limit
}
-
+
return self.response(data)
+ @http.route(prefix + 'partner/pengajuan_tempo', auth='public', methods=['POST'], csrf=False)
+ @controller.Controller.must_authorized()
+ def write_pengajuan_tempo(self, **kw):
+ user_id = int(kw.get('user_id'))
+ user = request.env['res.users'].search([('id', '=', user_id)], limit=1)
+ company_name = kw.get('name')
+ partner_id = request.env['res.partner'].search([('name', 'like', company_name)], limit=1)
+
+ params = self.get_request_params(kw, {
+
+ # informasi perusahaan
+ # 'name': ['required', 'alias:name_tempo'],
+ 'industry_id': ['required', 'alias:industry_id_tempo'],
+ 'street': ['required', 'alias:street_tempo'],
+ 'state': ['required', 'alias:state_id_tempo'],
+ 'city': ['required', 'alias:city_id_tempo'],
+ 'zip': ['required', 'alias:zip_tempo'],
+ 'mobile': ['required', 'alias:mobile_tempo'],
+ 'bankName': ['required', 'alias:bank_name_tempo'],
+ 'accountName': ['required', 'alias:account_name_tempo'],
+ 'accountNumber': ['required', 'alias:account_number_tempo'],
+ 'website': ['alias:website_tempo'],
+ 'estimasi': ['required', 'alias:estimasi_tempo'],
+ 'tempoDuration': ['required', 'alias:tempo_duration'],
+ 'tempoLimit': ['required', 'alias:tempo_limit'],
+
+ # informasi perusahaan
+ 'direkturName': ['required', 'alias:direktur_name'],
+ 'direkturMobile': ['required', 'alias:direktur_mobile'],
+ 'direkturEmail': ['required', 'alias:direktur_email'],
+ 'purchasingName': ['required', 'alias:purchasing_name'],
+ 'purchasingMobile': ['required', 'alias:purchasing_mobile'],
+ 'purchasingEmail': ['required', 'alias:purchasing_email'],
+ 'financeName': ['required', 'alias:finance_name'],
+ 'financeMobile': ['required', 'alias:finance_mobile'],
+ 'financeEmail': ['required', 'alias:finance_email'],
+
+ # Pengiriman
+ 'PICName': ['required', 'alias:pic_name'],
+ 'streetPengiriman': ['required', 'alias:street_pengiriman'],
+ 'statePengiriman': ['required', 'alias:state_id_pengiriman'],
+ 'cityPengiriman': ['required', 'alias:city_id_pengiriman'],
+ 'zipPengiriman': ['required', 'alias:zip_pengiriman'],
+ 'invoicePic': ['required', 'alias:invoice_pic'],
+ 'streetInvoice': ['required', 'alias:street_invoice'],
+ 'stateInvoice': ['required', 'alias:state_id_invoice'],
+ 'cityInvoice': ['required', 'alias:city_id_invoice'],
+ })
+ if not params['valid']:
+ return self.response(code=400, description=params)
+ pengajuan_tempo = request.env['user.pengajuan.tempo'].create([params['value']])
+
+ if partner_id:
+ pengajuan_tempo.name_tempo = partner_id
+
+ form_supplier_data = kw.get('formSupplier')
+
+ if form_supplier_data:
+ try:
+ form_supplier_data = json.loads(form_supplier_data)
+
+ for item in form_supplier_data:
+ supplier_name = item.get("supplier")
+ pic_name = item.get("pic")
+ phone = item.get("telepon")
+ tempo_duration = item.get("durasiTempo")
+ credit_limit = item.get("creditLimit")
+
+ new_data = {
+ 'name_supplier': supplier_name,
+ 'pengajuan_tempo_id': pengajuan_tempo.id,
+ 'pengajuan_tempo_partner': False,
+ 'pic_name': pic_name,
+ 'phone': phone,
+ 'tempo_duration': tempo_duration,
+ 'credit_limit': credit_limit,
+ }
+ new_supplier_data = request.env['user.pengajuan.tempo.line'].create(new_data)
+
+ except json.JSONDecodeError:
+ return http.Response(status=400, json_body={'error': 'Invalid JSON format for formSupplier'})
+ category_produk_ids = kw.get('categoryProduk')
+ category_ids = list(map(int, category_produk_ids.split(',')))
+
+ pengajuan_tempo.category_produk_ids = [(6, 0, category_ids)]
+ every_weekday = True if kw.get('everyWeekday') == "true" else False
+ every_weekday_input = kw.get('everyWeekdayInput')
+ every_week = True if kw.get('everyWeek') == 'true' else False
+ every_week_input = kw.get('everyWeekInput')
+ tukar_invoice = True if kw.get('tukarInvoice') == 'true' else False
+ tukar_invoice_input = kw.get('tukarInvoiceInput')
+ jadwal_tukar_invoice = ""
+ if every_weekday:
+ jadwal_tukar_invoice += f"setiap hari {every_weekday_input}"
+ if every_week:
+ jadwal_tukar_invoice += f", setiap {every_week_input}"
+ if tukar_invoice or tukar_invoice_input:
+ jadwal_tukar_invoice += f", {tukar_invoice_input}"
+
+ pengajuan_tempo.tukar_invoice = jadwal_tukar_invoice
+
+ every_weekday_pembayaran = True if kw.get('everyWeekdayPembayaran') == 'true' else False
+ every_weekday_input_pembayaran = kw.get('everyWeekdayInputPembayaran')
+ every_week_pembayaran = True if kw.get('everyWeekPembayaran') == 'true' else False
+ every_week_input_pembayaran = kw.get('everyWeekInputPembayaran')
+ tukar_invoice_pembayaran = True if kw.get('tukarInvoicePembayaran') == 'true' else False
+ tukar_invoice_input_pembayaran = kw.get('tukarInvoiceInputPembayaran')
+ jadwal_tukar_invoice_pembayaran = ""
+ if every_weekday_pembayaran:
+ jadwal_tukar_invoice_pembayaran += f"setiap hari {every_weekday_input_pembayaran}"
+ if every_week_pembayaran:
+ jadwal_tukar_invoice_pembayaran += f", setiap {every_week_input_pembayaran}"
+ if tukar_invoice_pembayaran or tukar_invoice_input_pembayaran:
+ jadwal_tukar_invoice_pembayaran += f", {tukar_invoice_input_pembayaran}"
+
+ pengajuan_tempo.jadwal_bayar = jadwal_tukar_invoice_pembayaran
+
+ dokumen_kirim = [
+ 'Surat Tanda Terima Barang (STTB)',
+ 'Good Receipt (GR)',
+ 'Surat Terima Barang (STB)',
+ 'Lembar Penerimaan Barang (LPB)'
+ ]
+
+ dokumen_kirim_barang_ids = kw.get('dokumenPengiriman')
+ dokumen_kirim_barang_input = kw.get('dokumenPengirimanInput', '')
+ dokumen_kirim_barang = []
+
+ if dokumen_kirim_barang_ids:
+ dokumen_kirim_ids = list(map(int, dokumen_kirim_barang_ids.split(',')))
+ dokumen_kirim_barang = [dokumen_kirim[i] for i in dokumen_kirim_ids if 0 <= i < len(dokumen_kirim)]
+
+ if dokumen_kirim_barang_input:
+ input_items = [item.strip() for item in dokumen_kirim_barang_input.split(',')]
+ dokumen_kirim_barang.extend(item for item in input_items if item and item not in dokumen_kirim_barang)
+
+ pengajuan_tempo.dokumen_pengiriman = ', '.join(dokumen_kirim_barang)
+
+ dokumen = [
+ 'Invoice Pembelian',
+ 'Surat Jalan',
+ 'Berita Acara Serah Terima (BAST)',
+ 'Faktur Pajak',
+ 'Good Receipt (GR)'
+ ]
+
+ dokumen_invoice_ids = kw.get('dokumenPengirimanInvoice')
+ dokumen_invoice_input = kw.get('dokumenPengirimanInvoiceInput', '')
+ dokumen_invoice = ""
+
+ if dokumen_kirim_barang_ids:
+ dokumen_ids = list(map(int, dokumen_invoice_ids.split(',')))
+ dokumen_invoice = [dokumen[i] for i in dokumen_ids if 0 <= i < len(dokumen)]
+ if dokumen_invoice_input:
+ input_items = [item.strip() for item in dokumen_invoice_input.split(',')]
+ dokumen_invoice.extend(item for item in input_items if item and item not in dokumen_invoice)
+
+ pengajuan_tempo.dokumen_invoice = ', '.join(dokumen_invoice)
+
+ form_dokumen_data = kw.get('formDocs')
+ if form_dokumen_data:
+ try:
+ form_dokumen = json.loads(form_dokumen_data)
+
+ for dokumen in form_dokumen:
+ if dokumen['details']['base64'] != '':
+ mimetype, _ = mimetypes.guess_type(dokumen['details']['name'])
+ mimetype = mimetype or 'application/octet-stream'
+ data = base64.b64decode(dokumen['details']['base64'])
+ sppkp_attachment = request.env['ir.attachment'].create({
+ 'name': dokumen['details']['name'],
+ 'type': 'binary',
+ 'datas': base64.b64encode(data),
+ 'res_model': 'user.pengajuan.tempo',
+ 'res_id': pengajuan_tempo.id,
+ 'mimetype': mimetype
+ })
+
+ if dokumen['documentName'] == 'dokumenNib' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_nib = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenNpwp' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_npwp = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenSppkp' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_sppkp = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenAktaPerubahan' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_akta_perubahan = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenKtpDirut' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_ktp_dirut = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenAktaPendirian' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_akta_pendirian = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenLaporanKeuangan' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_laporan_keuangan = [(4, sppkp_attachment.id)]
+
+ elif dokumen['documentName'] == 'dokumenFotoKantor' and dokumen['details']['base64'] != '':
+ pengajuan_tempo.dokumen_foto_kantor = [(4, sppkp_attachment.id)]
+
+ else:
+ pengajuan_tempo.dokumen_tempat_bekerja = [(4, sppkp_attachment.id)]
+
+ formatted_text = ''.join([' ' + char if char.isupper() and i != 0 else char for i, char in enumerate(dokumen['documentName'])])
+ teks = formatted_text.strip().title()
+ pengajuan_tempo.message_post(body=teks, attachment_ids=[sppkp_attachment.id])
+
+ except json.JSONDecodeError:
+ return http.Response(status=400, json_body={'error': 'Invalid JSON format for formDokumen'})
+
+ tempo_request = request.env['user.pengajuan.tempo.request'].create({
+ 'user_id': user.partner_id.id,
+ 'pengajuan_tempo_id': pengajuan_tempo.id,
+ 'user_input': partner_id.name
+ })
+ return self.response({
+ 'id': user_id,
+ })
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index c8a658b5..2ec5e720 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -30,6 +30,7 @@
'views/web_logging/user_activity_log.xml',
'views/web_logging/web_utm_source.xml',
'views/user_company_request.xml',
+ 'views/user_pengajuan_tempo_request.xml',
'views/vit_kelurahan.xml',
'views/vit_kecamatan.xml',
'views/vit_kota.xml',
@@ -145,6 +146,7 @@
'views/approval_unreserve.xml',
'views/vendor_approval.xml',
'views/find_page.xml',
+ 'views/user_pengajuan_tempo.xml',
'report/report.xml',
'report/report_banner_banner.xml',
'report/report_banner_banner2.xml',
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index e62fbb4a..a2a445bc 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -34,6 +34,7 @@ from . import stock_picking_type
from . import stock_picking
from . import stock_vendor
from . import user_company_request
+from . import user_pengajuan_tempo_request
from . import users
from . import website_brand_homepage
from . import website_categories_homepage
@@ -131,3 +132,5 @@ from . import approval_unreserve
from . import vendor_approval
from . import partner
from . import find_page
+from . import user_pengajuan_tempo_line
+from . import user_pengajuan_tempo \ No newline at end of file
diff --git a/indoteknik_custom/models/pengajuan_tempo.py b/indoteknik_custom/models/pengajuan_tempo.py
deleted file mode 100644
index 908843c7..00000000
--- a/indoteknik_custom/models/pengajuan_tempo.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from odoo import models, fields
-from datetime import datetime, timedelta
-
-
-class PengajuanTempo(models.Model):
- _inherit = "pengajuan.tempo"
-
- name = fields.Char(string="Nama Perusahaan")
- street = fields.Char(string="Alamat Perusahaan")
- site_id = fields.Many2one('res.partner.site', string='Site')
- mobile = fields.Char(string="No. Telfon Perusahaan")
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index bf7c45ad..c2b54dd9 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -8,23 +8,74 @@ class GroupPartner(models.Model):
name = fields.Char(string='Name')
-class PengajuanTempoSupplier(models.Model):
- _name = 'pengajuan.tempo.supplier'
- # Fields untuk tabel supplier
- name_supplier = fields.Char(string="Nama Supplier")
- pic_name = fields.Char(string="PIC")
- phone = fields.Char(string="Telepon")
- tempo_duration = fields.Char(string="Durasi Tempo")
- credit_limit = fields.Char(string="Credit Limit")
- pengajuan_tempo_id = fields.Many2one('new.pengajuan.tempo', string="Pengajuan Tempo", ondelete='cascade')
+# class NewPengajuanTempo(models.Model):
+# _name = 'new.pengajuan.tempo'
+#
+# # Referensi
+# supplier_ids = fields.One2many('pengajuan.tempo.line', 'pengajuan_tempo_id', string="Suppliers")
+#
+# # informasi perusahaan
+# name_tempo = fields.Char(string="Nama Perusahaan")
+# industry_id_tempo = fields.Many2one('res.partner.industry', 'Customer Industry', readonly=True)
+# street_tempo = fields.Char(string="Alamat Perusahaan")
+# state_id_tempo = fields.Many2one('res.country.state', string='State')
+# city_id_tempo = fields.Many2one('vit.kota', string='City')
+# zip_tempo = fields.Char(string="Zip")
+# mobile_tempo = fields.Char(string="No. Telfon Perusahaan")
+# bank_name_tempo = fields.Char(string="Nama Bank")
+# account_name_tempo = fields.Char(string="Nama Rekening")
+# account_number_tempo = fields.Char(string="Nomor Rekening Bank")
+# website_tempo = fields.Char(string='Website')
+# estimasi_tempo = fields.Char(string='Estimasi Pembelian Pertahun')
+# tempo_duration = fields.Char(string='Durasi Tempo')
+# tempo_limit = fields.Char(string='Limit Tempo')
+# category_produk_ids = fields.Many2many('product.public.category', string='Kategori Produk yang Digunakan', domain=lambda self: self._get_default_category_domain())
+#
+# @api.model
+# def _get_default_category_domain(self):
+# return [('parent_id', '=', False)]
+#
+# # Kontak Perusahaan
+# direktur_name = fields.Char(string='Nama Lengkap Direktur')
+# direktur_mobile = fields.Char(string='No. Telpon Direktur')
+# direktur_email = fields.Char(string='Email Direktur')
+# purchasing_name = fields.Char(string='Nama Purchasing')
+# purchasing_mobile = fields.Char(string='No. Telpon Purchasing')
+# purchasing_email = fields.Char(string='Email Purchasing')
+# finance_name = fields.Char(string='Nama Finance')
+# finance_mobile = fields.Char(string='No. Telpon Finance')
+# finance_email = fields.Char(string='Email Finance')
+#
+# # Pengiriman
+# pic_name = fields.Char(string='Nama PIC Penerimaan Barang')
+# street_pengiriman = fields.Char(string="Alamat Perusahaan")
+# state_id_pengiriman = fields.Many2one('res.country.state', string='State')
+# city_id_pengiriman = fields.Many2one('vit.kota', string='City')
+# zip_pengiriman = fields.Char(string="Zip")
+# invoice_pic = fields.Char(string='Nama PIC Penerimaan Invoice')
+# street_invoice = fields.Char(string="Alamat Perusahaan")
+# country_id_invoice = fields.Many2one('res.country', string='Country')
+# state_id_invoice = fields.Many2one('res.country.state', string='State')
+# city_id_invoice = fields.Many2one('vit.kota', string='City')
+# tukar_invoice = fields.Char(string='Jadwal Penukaran Invoice')
+# jadwal_bayar = fields.Char(string='Jadwal Pembayaran')
+# dokumen_pengiriman = fields.Char(string='Dokumen saat Pengiriman Barang')
+# dokumen_invoice = fields.Char(string='Dokumen yang dilampirkan saat Pengiriman Invoice')
-class NewPengajuanTempo(models.Model):
- _name = 'new.pengajuan.tempo'
- _inherit = 'pengajuan.tempo.supplier'
+
+
+class ResPartner(models.Model):
+ _inherit = 'res.partner'
+
+ # Referensi
+ supplier_ids = fields.One2many('user.pengajuan.tempo.line', 'pengajuan_tempo_partner', string="Suppliers")
# informasi perusahaan
- name_tempo = fields.Char(string="Nama Perusahaan")
+ name_tempo = fields.Many2one(
+ 'res.partner', string='Nama Perusahaan',
+ tracking=True, # Menambahkan tracking=True
+ )
industry_id_tempo = fields.Many2one('res.partner.industry', 'Customer Industry', readonly=True)
street_tempo = fields.Char(string="Alamat Perusahaan")
state_id_tempo = fields.Many2one('res.country.state', string='State')
@@ -38,7 +89,8 @@ class NewPengajuanTempo(models.Model):
estimasi_tempo = fields.Char(string='Estimasi Pembelian Pertahun')
tempo_duration = fields.Char(string='Durasi Tempo')
tempo_limit = fields.Char(string='Limit Tempo')
- category_produk_ids = fields.Many2many('product.public.category', string='Kategori Produk yang Digunakan', domain=lambda self: self._get_default_category_domain())
+ category_produk_ids = fields.Many2many('product.public.category', string='Kategori Produk yang Digunakan',
+ domain=lambda self: self._get_default_category_domain())
@api.model
def _get_default_category_domain(self):
@@ -63,7 +115,6 @@ class NewPengajuanTempo(models.Model):
zip_pengiriman = fields.Char(string="Zip")
invoice_pic = fields.Char(string='Nama PIC Penerimaan Invoice')
street_invoice = fields.Char(string="Alamat Perusahaan")
- country_id_invoice = fields.Many2one('res.country', string='Country')
state_id_invoice = fields.Many2one('res.country.state', string='State')
city_id_invoice = fields.Many2one('vit.kota', string='City')
tukar_invoice = fields.Char(string='Jadwal Penukaran Invoice')
@@ -71,19 +122,17 @@ class NewPengajuanTempo(models.Model):
dokumen_pengiriman = fields.Char(string='Dokumen saat Pengiriman Barang')
dokumen_invoice = fields.Char(string='Dokumen yang dilampirkan saat Pengiriman Invoice')
- # Referensi
- # supplier_ids = fields.One2many('pengajuan.tempo.supplier',)
- # category_id = fields.Many2one('product.public.category', string='Category Level 1')
- supplier_ids = fields.One2many('pengajuan.tempo.supplier', 'pengajuan_tempo_id', string="Suppliers")
-
-
-
-class ResPartner(models.Model):
- _name = 'res.partner'
- _inherit = ['res.partner', 'new.pengajuan.tempo']
+ # Dokumen
+ dokumen_nib = fields.Many2one('ir.attachment', string="NIB (SIUP/TDP/SKDP)", tracking=3, readonly=True,)
+ dokumen_npwp = fields.Many2one('ir.attachment', string="NPWP Perusahaan", tracking=3, readonly=True)
+ dokumen_sppkp = fields.Many2one('ir.attachment', string="SPPKP Perusahaan", tracking=3, readonly=True)
+ dokumen_akta_perubahan = fields.Many2one('ir.attachment', string="Akta Perubahan", tracking=3, readonly=True)
+ dokumen_ktp_dirut = fields.Many2one('ir.attachment', string="KTP Dirut/Direktur", tracking=3, readonly=True)
+ dokumen_akta_pendirian = fields.Many2one('ir.attachment', string="Akta Pendirian", tracking=3, readonly=True)
+ dokumen_laporan_keuangan = fields.Many2one('ir.attachment', string="Laporan Keuangan", tracking=3, readonly=True)
+ dokumen_foto_kantor = fields.Many2one('ir.attachment', string=" Foto Kantor (Tampak Depan)", tracking=3, readonly=True)
+ dokumen_tempat_bekerja = fields.Many2one('ir.attachment', string="Tempat Bekerja", tracking=3, readonly=True)
- # Relasi ke web.pengajuan.tempo
- pengajuan_tempo_id = fields.Many2one('web.pengajuan.tempo', string="Pengajuan Tempo")
reference_number = fields.Char(string="Reference Number")
company_type_id = fields.Many2one('res.partner.company_type', string='Company Type')
custom_pricelist_id = fields.Many2one('product.pricelist', string='Price Matrix')
diff --git a/indoteknik_custom/models/user_pengajuan_tempo.py b/indoteknik_custom/models/user_pengajuan_tempo.py
new file mode 100644
index 00000000..42380fe9
--- /dev/null
+++ b/indoteknik_custom/models/user_pengajuan_tempo.py
@@ -0,0 +1,148 @@
+from odoo import models, fields, api
+from datetime import datetime, timedelta
+
+
+# class IrAttachment(models.Model):
+# _inherit = 'ir.attachment'
+#
+# @api.model
+# def create(self, vals):
+# attachment = super(IrAttachment, self).create(vals)
+# if attachment:
+# base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
+# attachment.url = f"/web/content/{attachment.id}"
+# return attachment
+
+
+class UserPengajuanTempo(models.Model):
+ _name = 'user.pengajuan.tempo'
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+ partner_id = fields.Char()
+
+ # informasi perusahaan
+ # name_tempo = fields.Many2one(
+ # 'res.partner', string='Nama Perusahaan',
+ # readonly=True, required=True,
+ # states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]},
+ # domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",
+ # tracking=True, # Menambahkan tracking=True
+ # )
+ name_tempo = fields.Many2one(
+ 'res.partner', string='Nama Perusahaan',
+ tracking=True, # Menambahkan tracking=True
+ )
+ industry_id_tempo = fields.Many2one('res.partner.industry', 'Customer Industry', readonly=True)
+ street_tempo = fields.Char(string="Alamat Perusahaan")
+ state_id_tempo = fields.Many2one('res.country.state', string='State')
+ city_id_tempo = fields.Many2one('vit.kota', string='City')
+ zip_tempo = fields.Char(string="Zip")
+ mobile_tempo = fields.Char(string="No. Telfon Perusahaan")
+ bank_name_tempo = fields.Char(string="Nama Bank")
+ account_name_tempo = fields.Char(string="Nama Rekening")
+ account_number_tempo = fields.Char(string="Nomor Rekening Bank")
+ website_tempo = fields.Char(string='Website')
+ estimasi_tempo = fields.Char(string='Estimasi Pembelian Pertahun')
+ tempo_duration = fields.Char(string='Durasi Tempo')
+ tempo_limit = fields.Char(string='Limit Tempo')
+ category_produk_ids = fields.Many2many('product.public.category', string='Kategori Produk yang Digunakan', domain=lambda self: self._get_default_category_domain())
+
+ @api.model
+ def _get_default_category_domain(self):
+ return [('parent_id', '=', False)]
+
+ # Kontak Perusahaan
+ direktur_name = fields.Char(string='Nama Lengkap Direktur')
+ direktur_mobile = fields.Char(string='No. Telpon Direktur')
+ direktur_email = fields.Char(string='Email Direktur')
+ purchasing_name = fields.Char(string='Nama Purchasing')
+ purchasing_mobile = fields.Char(string='No. Telpon Purchasing')
+ purchasing_email = fields.Char(string='Email Purchasing')
+ finance_name = fields.Char(string='Nama Finance')
+ finance_mobile = fields.Char(string='No. Telpon Finance')
+ finance_email = fields.Char(string='Email Finance')
+
+ # Pengiriman
+ pic_name = fields.Char(string='Nama PIC Penerimaan Barang')
+ street_pengiriman = fields.Char(string="Alamat Perusahaan")
+ state_id_pengiriman = fields.Many2one('res.country.state', string='State')
+ city_id_pengiriman = fields.Many2one('vit.kota', string='City')
+ zip_pengiriman = fields.Char(string="Zip")
+ invoice_pic = fields.Char(string='Nama PIC Penerimaan Invoice')
+ street_invoice = fields.Char(string="Alamat Perusahaan")
+ state_id_invoice = fields.Many2one('res.country.state', string='State')
+ city_id_invoice = fields.Many2one('vit.kota', string='City')
+ tukar_invoice = fields.Char(string='Jadwal Penukaran Invoice')
+ jadwal_bayar = fields.Char(string='Jadwal Pembayaran')
+ dokumen_pengiriman = fields.Char(string='Dokumen saat Pengiriman Barang')
+ dokumen_invoice = fields.Char(string='Dokumen yang dilampirkan saat Pengiriman Invoice')
+
+ # Referensi
+ supplier_ids = fields.One2many('user.pengajuan.tempo.line', 'pengajuan_tempo_id', string="Suppliers")
+
+ #Dokumen
+ dokumen_nib = fields.Many2many('ir.attachment', 'pengajuan_dokumen_nib_rel', string="NIB (SIUP/TDP/SKDP)", tracking=3, track_visibility="onchange")
+ dokumen_npwp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_npwp_rel', string="NPWP Perusahaan", tracking=3)
+ dokumen_sppkp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_sppkp_rel', string="SPPKP Perusahaan", tracking=3)
+ dokumen_akta_perubahan = fields.Many2many('ir.attachment', 'pengajuan_dokumen_akta_perubahan_rel',
+ string="Akta Perubahan", tracking=3)
+ dokumen_ktp_dirut = fields.Many2many('ir.attachment', 'pengajuan_dokumen_ktp_dirut_rel',
+ string="KTP Dirut/Direktur", tracking=3)
+ dokumen_akta_pendirian = fields.Many2many('ir.attachment', 'pengajuan_dokumen_angkta_pendirian_rel',
+ string="Akta Pendirian", tracking=3)
+ dokumen_laporan_keuangan = fields.Many2many('ir.attachment', 'pengajuan_dokumen_laporan_keuangan_rel',
+ string="Laporan Keuangan", tracking=3)
+ dokumen_foto_kantor = fields.Many2many('ir.attachment', 'pengajuan_dokumen_foto_kantor_rel',
+ string=" Foto Kantor (Tampak Depan)", tracking=3)
+ dokumen_tempat_bekerja = fields.Many2many('ir.attachment', 'pengajuan_dokumen_tempat_bekerja_rel',
+ string="Tempat Bekerja", tracking=3)
+ #
+ # def _compute_attachment_url(self):
+ # if self.id:
+ # return {
+ # 'type': 'ir.actions.act_url',
+ # 'url': 'http://localhost:8069/web/content/' % (self.id),
+ # 'target': 'user',
+ # }
+ # base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
+ # for record in self:
+ # # Buat URL list untuk attachment yang ada di dokumen_nib
+ # record.attachment_urls = [(attachment.id, f"{base_url}/web/content/{attachment.id}") for attachment in
+ # record.dokumen_nib]
+ #
+ # @api.model
+ # def create(self, vals):
+ # # Tangani pembuatan baru
+ # record = super(userPengajuanTempo, self).create(vals)
+ # if vals.get('dokumen_nib'):
+ # attachment_names = ', '.join(self.env['ir.attachment'].browse(vals['dokumen_nib'][0][2]).mapped('name'))
+ # record.message_post(body=f"Files added to NIB: {attachment_names}")
+ # return record
+ #
+ # def write(self, vals):
+ # # Ambil attachment sebelumnya
+ # for record in self:
+ # previous_files = record.dokumen_nib
+ # res = super(userPengajuanTempo, record).write(vals)
+ #
+ # if 'dokumen_nib' in vals:
+ # new_files = record.dokumen_nib
+ #
+ # # Periksa perbedaan antara file lama dan file baru
+ # added_files = new_files - previous_files
+ # removed_files = previous_files - new_files
+ #
+ # # Buat pesan log berdasarkan perubahan
+ # messages = []
+ # if added_files:
+ # added_names = ', '.join(added_files.mapped('name'))
+ # messages.append(f"Files added to NIB: {added_names}")
+ # if removed_files:
+ # removed_names = ', '.join(removed_files.mapped('name'))
+ # messages.append(f"Files removed from NIB: {removed_names}")
+ #
+ # # Post pesan ke log note jika ada perubahan
+ # if messages:
+ # record.message_post(body="<br/>".join(messages))
+ #
+ # return res
+
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_line.py b/indoteknik_custom/models/user_pengajuan_tempo_line.py
new file mode 100644
index 00000000..7571bd41
--- /dev/null
+++ b/indoteknik_custom/models/user_pengajuan_tempo_line.py
@@ -0,0 +1,14 @@
+from odoo import models, fields
+
+
+class PengajuanTempoLine(models.Model):
+ _name = 'user.pengajuan.tempo.line'
+
+ # Fields untuk tabel supplier
+ name_supplier = fields.Char(string="Nama Supplier")
+ pengajuan_tempo_id = fields.Many2one('user.pengajuan.tempo', string='Tempo Reference', required=True, ondelete='cascade')
+ pengajuan_tempo_partner = fields.Many2one('res.partner', string='Tempo Reference', ondelete='cascade')
+ pic_name = fields.Char(string="PIC")
+ phone = fields.Char(string="Telepon")
+ tempo_duration = fields.Char(string="Durasi Tempo")
+ credit_limit = fields.Char(string="Credit Limit") \ No newline at end of file
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py
new file mode 100644
index 00000000..6c04ab7c
--- /dev/null
+++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py
@@ -0,0 +1,184 @@
+from odoo import models, fields, api
+from odoo.exceptions import UserError
+from odoo.http import request
+
+class UserPengajuanTempoRequest(models.Model):
+ _name = 'user.pengajuan.tempo.request'
+ _rec_name = 'user_id'
+
+ user_id = fields.Many2one('res.partner', string='User')
+ user_company_id = fields.Many2one('res.partner', string='Company')
+ user_input = fields.Char(string='User Input')
+ is_approve = fields.Selection([
+ ('approved', 'Approve'),
+ ('rejected', 'Reject'),
+ ], string='Approval')
+ similar_company_ids = fields.Many2many('res.partner', compute="_compute_similar_companies", string="Similar Companies")
+ pengajuan_tempo_id = fields.Many2one('user.pengajuan.tempo', string='Form Tempo')
+
+ @api.depends('user_input')
+ def _compute_similar_companies(self):
+ for record in self:
+ if record.user_input:
+ record.similar_company_ids = [(6, 0, self.get_similar_companies(record.user_input))]
+ else:
+ record.similar_company_ids = [(6, 0, [])]
+
+ # def get_similar_companies(self, user_input):
+ # query = """
+ # SELECT id
+ # FROM res_partner
+ # WHERE levenshtein(name::text, %s) < 3
+ # ORDER BY levenshtein(name::text, %s) ASC
+ # """
+ # self.env.cr.execute(query, (user_input, user_input))
+ # return [row[0] for row in self.env.cr.fetchall()]
+
+ def get_similar_companies(self, user_input):
+ query = """
+ SELECT id
+ FROM res_partner
+ WHERE (name ILIKE %s OR levenshtein(name::text, %s) < 3)
+ AND active = TRUE AND is_company = TRUE
+ ORDER BY levenshtein(name::text, %s) ASC
+ """
+ # Menggunakan '%' untuk mencocokkan nama perusahaan sebagian
+ self.env.cr.execute(query, ('%' + user_input + '%', user_input, user_input))
+ company_ids = [row[0] for row in self.env.cr.fetchall()]
+ return company_ids
+
+ internal_input = fields.Char(string='Internal Input')
+ company_type = fields.Char(string='Company Type', compute='_compute_company_type')
+
+ @api.depends('user_company_id.customer_type')
+ def _compute_company_type(self):
+ for record in self:
+ if record.user_company_id.customer_type == 'nonpkp':
+ record.company_type = 'Non PKP'
+ elif record.user_company_id.customer_type == 'pkp':
+ record.company_type = 'PKP'
+ else:
+ record.company_type = 'company type belum di set'
+
+ def write(self, vals):
+ user = self.get_user_by_email(self.user_id.email)
+ user.parent_name = self.user_input
+ is_approve = vals.get('is_approve')
+ is_internal_input = vals.get('internal_input')
+ company_id = ''
+ if not self.user_company_id:
+ company_id = request.env['res.partner'].search([('id', '=', vals.get('user_company_id'))], limit=1)
+ if self.is_approve and is_approve:
+ raise UserError('Tidak dapat mengubah approval yang sudah diisi')
+
+ if is_internal_input:
+ if self.user_company_id.nama_wajib_pajak == self.user_company_id.name:
+ self.user_company_id.nama_wajib_pajak = is_internal_input
+ self.user_company_id.name = is_internal_input
+
+ if not self.is_approve and is_approve:
+ if is_approve == 'approved':
+ self.pengajuan_tempo_id.partner_id = self.user_id.id
+ # informasi perusahaan
+ company_id.name_tempo = self.pengajuan_tempo_id.name_tempo
+ company_id.industry_id_tempo = self.pengajuan_tempo_id.industry_id_tempo
+ company_id.street_tempo = self.pengajuan_tempo_id.street_tempo
+ company_id.state_id_tempo = self.pengajuan_tempo_id.state_id_tempo
+ company_id.city_id_tempo = self.pengajuan_tempo_id.city_id_tempo
+ company_id.zip_tempo = self.pengajuan_tempo_id.zip_tempo
+ company_id.mobile_tempo = self.pengajuan_tempo_id.mobile_tempo
+ company_id.bank_name_tempo = self.pengajuan_tempo_id.bank_name_tempo
+ company_id.account_name_tempo = self.pengajuan_tempo_id.account_name_tempo
+ company_id.account_number_tempo = self.pengajuan_tempo_id.account_number_tempo
+ company_id.website_tempo = self.pengajuan_tempo_id.website_tempo
+ company_id.estimasi_tempo = self.pengajuan_tempo_id.estimasi_tempo
+ company_id.tempo_duration = self.pengajuan_tempo_id.tempo_duration
+ company_id.tempo_limit = self.pengajuan_tempo_id.tempo_limit
+ company_id.category_produk_ids = self.pengajuan_tempo_id.category_produk_ids
+
+ # Kontak Perusahaan
+ company_id.direktur_name = self.pengajuan_tempo_id.direktur_name
+ company_id.direktur_mobile = self.pengajuan_tempo_id.direktur_mobile
+ company_id.direktur_email = self.pengajuan_tempo_id.direktur_email
+ company_id.purchasing_name = self.pengajuan_tempo_id.purchasing_name
+ company_id.purchasing_mobile = self.pengajuan_tempo_id.purchasing_mobile
+ company_id.purchasing_email = self.pengajuan_tempo_id.purchasing_email
+ company_id.finance_name = self.pengajuan_tempo_id.finance_name
+ company_id.finance_mobile = self.pengajuan_tempo_id.finance_mobile
+ company_id.finance_email = self.pengajuan_tempo_id.finance_email
+
+ # Pengiriman
+ company_id.pic_name = self.pengajuan_tempo_id.pic_name
+ company_id.street_pengiriman = self.pengajuan_tempo_id.street_pengiriman
+ company_id.state_id_pengiriman = self.pengajuan_tempo_id.state_id_pengiriman
+ company_id.city_id_pengiriman = self.pengajuan_tempo_id.city_id_pengiriman
+ company_id.zip_pengiriman = self.pengajuan_tempo_id.zip_pengiriman
+ company_id.invoice_pic = self.pengajuan_tempo_id.invoice_pic
+ company_id.street_invoice = self.pengajuan_tempo_id.street_invoice
+ company_id.state_id_invoice = self.pengajuan_tempo_id.state_id_invoice
+ company_id.city_id_invoice = self.pengajuan_tempo_id.city_id_invoice
+ company_id.tukar_invoice = self.pengajuan_tempo_id.tukar_invoice
+ company_id.jadwal_bayar = self.pengajuan_tempo_id.jadwal_bayar
+ company_id.dokumen_pengiriman = self.pengajuan_tempo_id.dokumen_pengiriman
+ company_id.dokumen_invoice = self.pengajuan_tempo_id.dokumen_invoice
+
+ # Referensi
+ company_id.supplier_ids = self.pengajuan_tempo_id.supplier_ids
+
+ # Dokumen
+ company_id.dokumen_nib = self.pengajuan_tempo_id.dokumen_nib
+ if company_id.dokumen_nib:
+ company_id.message_post(body='Dokumen NIB', attachment_ids=[company_id.dokumen_nib.id])
+
+ company_id.dokumen_npwp = self.pengajuan_tempo_id.dokumen_npwp
+ if company_id.dokumen_npwp:
+ company_id.message_post(body='Dokumen NPWP', attachment_ids=[company_id.dokumen_npwp.id])
+
+ company_id.dokumen_sppkp = self.pengajuan_tempo_id.dokumen_sppkp
+ if company_id.dokumen_sppkp:
+ company_id.message_post(body='Dokumen SPPKP', attachment_ids=[company_id.dokumen_sppkp.id])
+
+ company_id.dokumen_akta_perubahan = self.pengajuan_tempo_id.dokumen_akta_perubahan
+ if company_id.dokumen_akta_perubahan:
+ company_id.message_post(body='Dokumen Akta Perubahan',
+ attachment_ids=[company_id.dokumen_akta_perubahan.id])
+
+ company_id.dokumen_ktp_dirut = self.pengajuan_tempo_id.dokumen_ktp_dirut
+ if company_id.dokumen_ktp_dirut:
+ company_id.message_post(body='Dokumen Ktp Dirut',
+ attachment_ids=[company_id.dokumen_ktp_dirut.id])
+
+ company_id.dokumen_akta_pendirian = self.pengajuan_tempo_id.dokumen_akta_pendirian
+ if company_id.dokumen_akta_pendirian:
+ company_id.message_post(body='Dokumen Akta Pendirian',
+ attachment_ids=[company_id.dokumen_akta_pendirian.id])
+
+ company_id.dokumen_laporan_keuangan = self.pengajuan_tempo_id.dokumen_laporan_keuangan
+ if company_id.dokumen_laporan_keuangan:
+ company_id.message_post(body='Dokumen Laporan Keuangan',
+ attachment_ids=[company_id.dokumen_laporan_keuangan.id])
+
+ company_id.dokumen_foto_kantor = self.pengajuan_tempo_id.dokumen_foto_kantor
+ if company_id.dokumen_foto_kantor:
+ company_id.message_post(body='Dokumen Foto Kantor',
+ attachment_ids=[company_id.dokumen_foto_kantor.id])
+
+ company_id.dokumen_tempat_bekerja = self.pengajuan_tempo_id.dokumen_tempat_bekerja
+ if company_id.dokumen_tempat_bekerja:
+ company_id.message_post(body='Dokumen Tempat Bekerja',
+ attachment_ids=[company_id.dokumen_tempat_bekerja.id])
+ # self.user_company_id.active = True
+ # user.send_company_request_approve_mail()
+ else:
+ new_company = self.env['res.partner'].create({
+ 'name': self.user_input
+ })
+ # self.user_id.parent_id = new_company.id
+ # user.send_company_request_reject_mail()
+ return super(UserPengajuanTempoRequest, self).write(vals)
+
+ def get_user_by_email(self, email):
+ return request.env['res.users'].search([
+ ('login', '=', email),
+ ('active', 'in', [True, False])
+ ]) \ No newline at end of file
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 398a3067..1369a03a 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -44,6 +44,7 @@ access_wati_notification,access.wati.notification,model_wati_notification,,1,1,1
access_wati_api,access.wati.api,model_wati_api,,1,1,1,1
access_wati_contact,access.wati.contact,model_wati_contact,,1,1,1,1
access_user_company_request,access.user.company.request,model_user_company_request,,1,1,1,1
+access_user_pengajuan_tempo_request,access.user.pengajuan.tempo.request,model_user_pengajuan_tempo_request,,1,1,1,1
access_res_partner_company_type,access.res.partner.company_type,model_res_partner_company_type,,1,1,1,1
access_uangmuka_penjualan,access.uangmuka.penjualan,model_uangmuka_penjualan,,1,1,1,1
access_uangmuka_pembelian,access.uangmuka.pembelian,model_uangmuka_pembelian,,1,1,1,1
@@ -143,4 +144,5 @@ access_vendor_approval_line,access.vendor.approval.line,model_vendor_approval_li
access_vit_kota,access.vit.kota,model_vit_kota,,1,1,1,1
access_v_brand_product_category,access.v.brand.product.category,model_v_brand_product_category,,1,1,1,1
access_web_find_page,access.web.find.page,model_web_find_page,,1,1,1,1
-access_pengajuan_tempo_supplier,access_pengajuan_tempo_supplier,model_pengajuan_tempo_supplier,base.group_user,1,1,1,1 \ No newline at end of file
+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 \ No newline at end of file
diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml
index 278f6d44..cc6b2357 100644
--- a/indoteknik_custom/views/res_partner.xml
+++ b/indoteknik_custom/views/res_partner.xml
@@ -73,16 +73,17 @@
</xpath>
<notebook>
<page string="Pengajuan Tempo">
- <group col="2">
- <group string="Informasi Usaha" colspan="1">
- <field name="name_tempo" />
+ <!-- Informasi Usaha Section -->
+ <group string="Informasi Usaha" colspan="4">
+ <group>
+ <field name="name_tempo"/>
<field name="industry_id_tempo"/>
- <field name="street_tempo" />
- <field name="state_id_tempo" />
- <field name="city_id_tempo" />
- <field name="zip_tempo" />
- <field name="mobile_tempo" />
- <field name="bank_name_tempo" />
+ <field name="street_tempo"/>
+ <field name="state_id_tempo"/>
+ <field name="city_id_tempo"/>
+ <field name="zip_tempo"/>
+ <field name="mobile_tempo"/>
+ <field name="bank_name_tempo"/>
<field name="account_name_tempo"/>
<field name="account_number_tempo"/>
<field name="website_tempo"/>
@@ -91,56 +92,74 @@
<field name="tempo_limit"/>
<field name="category_produk_ids" widget="many2many_tags"/>
</group>
- <group string="Kontak Person" colspan="1">
- <field name="direktur_name" />
+ </group>
+
+ <!-- Kontak Perusahaan Section -->
+ <group string="Kontak Perusahaan" colspan="4">
+ <group>
+ <field name="direktur_name"/>
<field name="direktur_mobile"/>
- <field name="direktur_email" />
- <field name="purchasing_name" />
- <field name="purchasing_mobile" />
- <field name="purchasing_email" />
- <field name="finance_name" />
- <field name="finance_mobile" />
- <field name="finance_email" />
+ <field name="direktur_email"/>
+ </group>
+ <group>
+ <field name="purchasing_name"/>
+ <field name="purchasing_mobile"/>
+ <field name="purchasing_email"/>
+ </group>
+ <group>
+ <field name="finance_name"/>
+ <field name="finance_mobile"/>
+ <field name="finance_email"/>
</group>
-
</group>
- <group col="2">
- <group string="Pengiriman" colspan="1">
- <field name="pic_name" />
- <field name="street_pengiriman" />
- <field name="state_id_pengiriman" />
- <field name="city_id_pengiriman" />
- <field name="zip_pengiriman" />
- <field name="invoice_pic" />
- <field name="street_invoice" />
- <field name="country_id_invoice" />
- <field name="state_id_invoice" />
- <field name="city_id_invoice" />
- <field name="tukar_invoice" />
- <field name="jadwal_bayar" />
- <field name="dokumen_pengiriman" />
- <field name="dokumen_invoice" />
- <field name="supplier_ids">
- <tree editable="bottom">
- <field name="name_supplier" string="Nama Supplier"/>
- <field name="pic_name" string="PIC"/>
- <field name="phone" string="Telepon"/>
- <field name="tempo_duration" string="Durasi Tempo"/>
- <field name="credit_limit" string="Credit Limit"/>
- </tree>
- </field>
+
+ <!-- Pengiriman Section -->
+ <group string="Pengiriman" colspan="4">
+ <group>
+ <field name="pic_name"/>
+ <field name="street_pengiriman"/>
+ <field name="state_id_pengiriman"/>
+ <field name="city_id_pengiriman"/>
+ <field name="zip_pengiriman"/>
</group>
-<!-- <group string="Referensi Supplier / Rekanan Bisnis Perusahaan" colspan="1">-->
-<!-- <field name="supplier_ids">-->
-<!-- <tree>-->
-<!-- <field name="name_supplier" string="Nama Supplier"/>-->
-<!-- <field name="pic_name" string="PIC"/>-->
-<!-- <field name="phone" string="Telepon"/>-->
-<!-- <field name="tempo_duration" string="Durasi Tempo"/>-->
-<!-- <field name="credit_limit" string="Credit Limit"/>-->
-<!-- </tree>-->
-<!-- </field>-->
-<!-- </group>-->
+ <group>
+ <field name="invoice_pic"/>
+ <field name="street_invoice"/>
+ <field name="state_id_invoice"/>
+ <field name="city_id_invoice"/>
+ </group>
+ <group>
+ <field name="tukar_invoice"/>
+ <field name="jadwal_bayar"/>
+ <field name="dokumen_pengiriman"/>
+ <field name="dokumen_invoice"/>
+ </group>
+ </group>
+
+ <!-- Supplier Lines Section -->
+ <group string="Suppliers">
+ <field name="supplier_ids">
+ <tree>
+ <field name="name_supplier"/>
+ <field name="pic_name"/>
+ <field name="phone"/>
+ <field name="tempo_duration"/>
+ <field name="credit_limit"/>
+ </tree>
+ </field>
+ </group>
+
+ <group string="Dokumen">
+ <field name="dokumen_nib" />
+ <field name="dokumen_npwp" />
+ <field name="dokumen_sppkp" />
+ <field name="dokumen_akta_perubahan" />
+ <field name="dokumen_ktp_dirut" />
+ <field name="dokumen_akta_pendirian" />
+ <field name="dokumen_laporan_keuangan" />
+ <field name="dokumen_ktp_dirut" />
+ <field name="dokumen_foto_kantor" />
+ <field name="dokumen_tempat_bekerja" />
</group>
</page>
</notebook>
diff --git a/indoteknik_custom/views/user_pengajuan_tempo.xml b/indoteknik_custom/views/user_pengajuan_tempo.xml
new file mode 100644
index 00000000..9874d79d
--- /dev/null
+++ b/indoteknik_custom/views/user_pengajuan_tempo.xml
@@ -0,0 +1,129 @@
+<odoo>
+ <!-- Form view for userPengajuanTempo -->
+ <record id="view_user_pengajuan_tempo_form" model="ir.ui.view">
+ <field name="name">user.pengajuan.tempo.form</field>
+ <field name="model">user.pengajuan.tempo</field>
+ <field name="arch" type="xml">
+ <form string="Pengajuan Tempo">
+ <sheet>
+ <!-- Informasi Usaha Section -->
+ <group string="Informasi Usaha" colspan="4">
+ <group>
+ <field name="name_tempo"/>
+ <field name="industry_id_tempo"/>
+ <field name="street_tempo"/>
+ <field name="state_id_tempo"/>
+ <field name="city_id_tempo"/>
+ <field name="zip_tempo"/>
+ <field name="mobile_tempo"/>
+ <field name="bank_name_tempo"/>
+ <field name="account_name_tempo"/>
+ <field name="account_number_tempo"/>
+ <field name="website_tempo"/>
+ <field name="estimasi_tempo"/>
+ <field name="tempo_duration"/>
+ <field name="tempo_limit"/>
+ <field name="category_produk_ids" widget="many2many_tags"/>
+ </group>
+ </group>
+
+ <!-- Kontak Perusahaan Section -->
+ <group string="Kontak Perusahaan" colspan="4">
+ <group>
+ <field name="direktur_name"/>
+ <field name="direktur_mobile"/>
+ <field name="direktur_email"/>
+ </group>
+ <group>
+ <field name="purchasing_name"/>
+ <field name="purchasing_mobile"/>
+ <field name="purchasing_email"/>
+ </group>
+ <group>
+ <field name="finance_name"/>
+ <field name="finance_mobile"/>
+ <field name="finance_email"/>
+ </group>
+ </group>
+
+ <!-- Pengiriman Section -->
+ <group string="Pengiriman" colspan="4">
+ <group>
+ <field name="pic_name"/>
+ <field name="street_pengiriman"/>
+ <field name="state_id_pengiriman"/>
+ <field name="city_id_pengiriman"/>
+ <field name="zip_pengiriman"/>
+ </group>
+ <group>
+ <field name="invoice_pic"/>
+ <field name="street_invoice"/>
+ <field name="state_id_invoice"/>
+ <field name="city_id_invoice"/>
+ </group>
+ <group>
+ <field name="tukar_invoice"/>
+ <field name="jadwal_bayar"/>
+ <field name="dokumen_pengiriman"/>
+ <field name="dokumen_invoice"/>
+ </group>
+ </group>
+
+ <!-- Supplier Lines Section -->
+ <group string="Suppliers">
+ <field name="supplier_ids">
+ <tree>
+ <field name="name_supplier"/>
+ <field name="pic_name"/>
+ <field name="phone"/>
+ <field name="tempo_duration"/>
+ <field name="credit_limit"/>
+ </tree>
+ </field>
+ </group>
+
+ <group string="Dokumen">
+ <field name="dokumen_nib" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_npwp" widget="many2many_binary" />
+ <field name="dokumen_sppkp" widget="many2many_binary" />
+ <field name="dokumen_akta_perubahan" widget="many2many_binary" />
+ <field name="dokumen_ktp_dirut" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_akta_pendirian" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_laporan_keuangan" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_ktp_dirut" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_foto_kantor" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ <field name="dokumen_tempat_bekerja" widget="many2many_binary" options="{'no_create': True, 'no_open': False}"/>
+ </group>
+ </sheet>
+ <div class="oe_chatter">
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
+ </form>
+ </field>
+ </record>
+
+ <!-- Tree view for userPengajuanTempo -->
+ <record id="view_user_pengajuan_tempo_tree" model="ir.ui.view">
+ <field name="name">user.pengajuan.tempo.tree</field>
+ <field name="model">user.pengajuan.tempo</field>
+ <field name="arch" type="xml">
+ <tree string="Pengajuan Tempo">
+ <field name="name_tempo"/>
+ <field name="industry_id_tempo"/>
+ <field name="tempo_limit"/>
+ <field name="estimasi_tempo"/>
+ </tree>
+ </field>
+ </record>
+
+ <!-- Action to open form and tree views -->
+ <record id="action_user_pengajuan_tempo" model="ir.actions.act_window">
+ <field name="name">Pengajuan Tempo</field>
+ <field name="res_model">user.pengajuan.tempo</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <!-- Menu item to access Pengajuan Tempo -->
+ <menuitem id="menu_user_pengajuan_tempo_root" name="Pengajuan Tempo" />
+ <menuitem id="menu_user_pengajuan_tempo" name="Pengajuan Tempo Records" parent="menu_user_pengajuan_tempo_root" action="action_user_pengajuan_tempo"/>
+</odoo>
diff --git a/indoteknik_custom/views/user_pengajuan_tempo_line.xml b/indoteknik_custom/views/user_pengajuan_tempo_line.xml
new file mode 100644
index 00000000..60b510bc
--- /dev/null
+++ b/indoteknik_custom/views/user_pengajuan_tempo_line.xml
@@ -0,0 +1,42 @@
+<odoo>
+ <record id="view_user_pengajuan_tempo_line_tree" model="ir.ui.view">
+ <field name="name">user_pengajuan.tempo.line.tree</field>
+ <field name="model">user_pengajuan.tempo.line</field>
+ <field name="arch" type="xml">
+ <tree string="Pengajuan Tempo Lines">
+ <field name="name_supplier" string="Nama Supplier"/>
+ <field name="pic_name" string="PIC"/>
+ <field name="phone" string="Telepon"/>
+ <field name="tempo_duration" string="Durasi Tempo"/>
+ <field name="credit_limit" string="Credit Limit"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_user_pengajuan_tempo_line_form" model="ir.ui.view">
+ <field name="name">pengajuan.tempo.line.form</field>
+ <field name="model">pengajuan.tempo.line</field>
+ <field name="arch" type="xml">
+ <form string="Pengajuan Tempo Line">
+ <group>
+ <field name="name_supplier"/>
+ <field name="pic_name"/>
+ <field name="phone"/>
+ <field name="tempo_duration"/>
+ <field name="credit_limit"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <!-- Action to open the list view -->
+ <record id="action_user_pengajuan_tempo_line" model="ir.actions.act_window">
+ <field name="name">Pengajuan Tempo Lines</field>
+ <field name="res_model">pengajuan.tempo.line</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <!-- Add a menu item to access the list view -->
+ <menuitem id="menu_user_pengajuan_tempo_line_root" name="Pengajuan Tempo" />
+ <menuitem id="menu_user_pengajuan_tempo_line" name="Pengajuan Tempo Lines" parent="menu_user_pengajuan_tempo_line_root" action="action_user_pengajuan_tempo_line"/>
+</odoo>
diff --git a/indoteknik_custom/views/user_pengajuan_tempo_request.xml b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
new file mode 100644
index 00000000..19d00d44
--- /dev/null
+++ b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="user_pengajuan_tempo_request_tree" model="ir.ui.view">
+ <field name="name">user.pengajuan.tempo.request.tree</field>
+ <field name="model">user.pengajuan.tempo.request</field>
+ <field name="arch" type="xml">
+ <tree create="1" default_order="create_date desc">
+ <field name="user_id"/>
+ <field name="pengajuan_tempo_id"/>
+ <field name="user_company_id"/>
+ <field name="user_input"/>
+ <field
+ name="is_approve"
+ widget="badge"
+ decoration-success="is_approve == 'approved'"
+ decoration-danger="is_approve == 'rejected'"
+ />
+ <field name="internal_input"/>
+ <field name="company_type"/>
+ <field name="create_date"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="user_pengajuan_tempo_request_form" model="ir.ui.view">
+ <field name="name">user.pengajuan.tempo.request.form</field>
+ <field name="model">user.pengajuan.tempo.request</field>
+ <field name="arch" type="xml">
+ <form create="0">
+ <sheet>
+ <group>
+ <group>
+ <field name="user_id" readonly="1"/>
+ <field name="pengajuan_tempo_id"/>
+ <field name="similar_company_ids" invisible="1"/>
+ <field name="user_company_id" domain="[('id', 'in', similar_company_ids)]"/>
+ <field name="user_input" readonly="1"/>
+ <field
+ name="is_approve"
+ required="1"
+ decoration-success="is_approve == 'approved'"
+ decoration-danger="is_approve == 'rejected'"
+ />
+ <field name="internal_input" />
+ <field name="company_type" readonly="1"/>
+ </group>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_user_pengajuan_tempo_request" model="ir.actions.act_window">
+ <field name="name">User Pengajuan Tempo Request</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">user.pengajuan.tempo.request</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem
+ id="menu_user_pengajuan_tempo_request"
+ name="User Pengajuan Tempo Request"
+ parent="contacts.menu_contacts"
+ sequence="3"
+ action="action_user_pengajuan_tempo_request"
+ />
+</odoo> \ No newline at end of file