diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-10-31 13:49:23 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-10-31 13:49:23 +0700 |
| commit | d8c12d085edbd81d974555780b16421c7b155f7f (patch) | |
| tree | ce8993a2fe4ccda62827dceb10b7acc097babc9c /indoteknik_custom/models | |
| parent | 4588b8df03628821dce6eb6029ac4bcd5065aba8 (diff) | |
<iman> update pengajuan tempo final
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/models/pengajuan_tempo.py | 11 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 103 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_pengajuan_tempo.py | 148 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_pengajuan_tempo_line.py | 14 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_pengajuan_tempo_request.py | 184 |
6 files changed, 425 insertions, 38 deletions
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 |
