1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
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()
_description = 'User Pengajuan Tempo'
name = fields.Char(string='Name')
# 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
)
user_id = fields.Many2one('res.users', string='User')
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')
district_id_tempo = fields.Many2one('vit.kecamatan', string='Kecamatan')
subDistrict_id_tempo = fields.Many2one('vit.kelurahan', string='Kelurahan')
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')
portal = fields.Boolean(string='Portal Website')
bersedia = fields.Char(string='Website')
estimasi_tempo = fields.Char(string='Estimasi Pembelian Pertahun')
tempo_duration = fields.Many2one('account.payment.term', 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_tittle = fields.Char(string='tittle Direktur')
direktur_name = fields.Char(string='Nama Lengkap Direktur')
direktur_mobile = fields.Char(string='No. Telpon Direktur')
direktur_email = fields.Char(string='Email Direktur')
purchasing_tittle = fields.Char(string='tittle Purchasing')
purchasing_name = fields.Char(string='Nama Purchasing')
purchasing_mobile = fields.Char(string='No. Telpon Purchasing')
purchasing_email = fields.Char(string='Email Purchasing')
finance_tittle = fields.Char(string='tittle Finance')
finance_name = fields.Char(string='Nama Finance')
finance_mobile = fields.Char(string='No. Telpon Finance')
finance_email = fields.Char(string='Email Finance')
# Pengiriman
pic_tittle = fields.Char(string='Tittle PIC Penerimaan Barang')
pic_mobile = fields.Char(string='Nomor HP PIC Penerimaan Barang')
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')
district_id_pengiriman = fields.Many2one('vit.kecamatan', string='Kecamatan')
subDistrict_id_pengiriman = fields.Many2one('vit.kelurahan', string='Kelurahan')
zip_pengiriman = fields.Char(string="Zip")
invoice_pic_tittle = fields.Char(string='Tittle PIC Penerimaan Invoice')
invoice_pic = fields.Char(string='Nama PIC Penerimaan Invoice')
invoice_pic_mobile = fields.Char(string='Nomor HP 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')
district_id_invoice = fields.Many2one('vit.kecamatan', string='Kecamatan')
subDistrict_id_invoice = fields.Many2one('vit.kelurahan', string='Kelurahan')
zip_invoice = fields.Char(string="Zip")
tukar_invoice = fields.Char(string='Jadwal Penukaran Invoice')
jadwal_bayar = fields.Char(string='Jadwal Pembayaran')
dokumen_pengiriman = fields.Char(string='Dokumen Tanda Terima yang Diberikan Pada Saat Pengiriman Barang')
dokumen_kirim_input = fields.Char(string='Dokumen lain yang diterima saat pengiriman barang')
dokumen_pengiriman_input = fields.Char(string='Dokumen yang Dibawa Saat Pengiriman Barang')
dokumen_invoice = fields.Char(string='Dokumen yang dilampirkan saat Pengiriman Invoice')
is_same_address = fields.Boolean(string="Same Address pengiriman invoicr dan alamat pengiriman barang")
is_same_address_street = fields.Boolean(string="Same Address pengiriman barang dan alamat bisnis")
dokumen_prosedur = fields.Many2many('ir.attachment', 'dokumen_prosedur_rel', string="Dokumen Prosedur", tracking=True)
# Referensi
supplier_ids = fields.Many2many('user.pengajuan.tempo.line', string="Suppliers")
#Dokumen
dokumen_nib = fields.Many2many('ir.attachment', 'pengajuan_dokumen_nib_rel', string="NIB", tracking=True, track_visibility="onchange")
dokumen_npwp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_npwp_rel', string="NPWP Perusahaan", tracking=True)
dokumen_sppkp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_sppkp_rel', string="SPPKP Perusahaan", tracking=True)
dokumen_siup = fields.Many2many('ir.attachment', 'pengajuan_dokumen_siup_rel', string="SIUP Perusahaan", tracking=True)
dokumen_tdp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_tdp_rel', string="TDP Perusahaan", tracking=True)
dokumen_skdp = fields.Many2many('ir.attachment', 'pengajuan_dokumen_skdp_rel', string="SKDP Perusahaan", tracking=True)
dokumen_skt = fields.Many2many('ir.attachment', 'pengajuan_dokumen_skt_rel', string="SKT Perusahaan", tracking=True)
dokumen_akta_perubahan = fields.Many2many('ir.attachment', 'pengajuan_dokumen_akta_perubahan_rel',
string="Akta Perubahan", tracking=True)
dokumen_ktp_dirut = fields.Many2many('ir.attachment', 'pengajuan_dokumen_ktp_dirut_rel',
string="KTP Dirut/Direktur", tracking=True)
dokumen_akta_pendirian = fields.Many2many('ir.attachment', 'pengajuan_dokumen_angkta_pendirian_rel',
string="Akta Pendirian", tracking=True)
dokumen_laporan_keuangan = fields.Many2many('ir.attachment', 'pengajuan_dokumen_laporan_keuangan_rel',
string="Laporan Keuangan", tracking=True)
dokumen_foto_kantor = fields.Many2many('ir.attachment', 'pengajuan_dokumen_foto_kantor_rel',
string=" Foto Kantor (Tampak Depan)", tracking=True)
dokumen_tempat_bekerja = fields.Many2many('ir.attachment', 'pengajuan_dokumen_tempat_bekerja_rel',
string="Tempat Bekerja", tracking=True)
@api.depends('name', 'name_tempo')
def name_get(self):
result = []
for record in self:
if record.name_tempo:
display_name = f"DETAIL FORM TEMPO - {record.name_tempo.name}"
else:
display_name = "DETAIL FORM TEMPO"
result.append((record.id, display_name))
return result
|