summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/user_merchant_request.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/user_merchant_request.py')
-rw-r--r--indoteknik_custom/models/user_merchant_request.py125
1 files changed, 0 insertions, 125 deletions
diff --git a/indoteknik_custom/models/user_merchant_request.py b/indoteknik_custom/models/user_merchant_request.py
deleted file mode 100644
index dd571cdc..00000000
--- a/indoteknik_custom/models/user_merchant_request.py
+++ /dev/null
@@ -1,125 +0,0 @@
-from odoo import models, fields, api, _
-from odoo.exceptions import UserError
-from odoo.http import request
-
-
-class RejectReasonWizardMerchant(models.TransientModel):
- _name = 'reject.reason.wizard.merchant'
- _description = 'Wizard for Reject Reason'
-
- request_id = fields.Many2one('user.merchant.request', string='Request')
- reason_reject = fields.Text(string='Reason for Rejection', required=True)
-
- def confirm_reject(self):
- merchant = self.request_id
- if merchant:
- merchant.write({'reason_reject': self.reason_reject})
- merchant.state_merchant = 'reject'
- return {'type': 'ir.actions.act_window_close'}
-
-
-class ConfirmApprovalWizardMerchant(models.TransientModel):
- _name = 'confirm.approval.wizard.merchant'
- _description = 'Wizard Konfirmasi Approval'
-
- merchant_id = fields.Many2one('user.merchant.request', string='Merchant', required=True)
-
- def confirm_approval(self):
- merchant = self.merchant_id
- if merchant.state_merchant == 'draft':
- merchant.state_merchant = 'approved'
-
-
-class UserMerchantRequest(models.Model):
- _name = 'user.merchant.request'
- _inherit = ['mail.thread', 'mail.activity.mixin']
- _rec_name = 'user_id'
-
- user_id = fields.Many2one('res.partner', string='User')
- merchant_id = fields.Many2one('user.form.merchant', string='Form Merchant')
- user_company_id = fields.Many2one('res.partner', string='Company')
- state_merchant = fields.Selection([
- ('draft', 'Pengajuan Merchant'),
- ('approved', 'Approved Merchant'),
- ('reject', 'Rejected'),
- ], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')
- reason_reject = fields.Char(string='Reaject Reason')
-
- def button_approve(self):
- for merchant in self:
- return {
- 'type': 'ir.actions.act_window',
- 'name': 'Konfirmasi Approve',
- 'res_model': 'confirm.approval.wizard.merchant',
- 'view_mode': 'form',
- 'target': 'new',
- 'context': {
- 'default_merchant_id': merchant.id,
- }}
-
- def button_reject(self):
- return {
- 'type': 'ir.actions.act_window',
- 'name': _('Reject Reason'),
- 'res_model': 'reject.reason.wizard.merchant',
- 'view_mode': 'form',
- 'target': 'new',
- 'context': {'default_request_id': self.id},
- }
-
- def write(self, vals):
- is_approve = True if self.state_merchant == 'approved' or vals.get('state_merchant') == 'approved' else False
- if is_approve:
- # Informasi Perusahaan
- self.user_company_id.name_merchant = self.merchant_id.name_merchant
- self.user_company_id.pejabat_name = self.merchant_id.pejabat_name
- self.user_company_id.pic_merchant = self.merchant_id.pic_merchant
- self.user_company_id.pic_position = self.merchant_id.pic_position
- self.user_company_id.address_merchant = self.merchant_id.address
- self.user_company_id.state_merchant = self.merchant_id.state
- self.user_company_id.city_merchant = self.merchant_id.city
- self.user_company_id.district_merchant = self.merchant_id.district
- self.user_company_id.subDistrict_merchant = self.merchant_id.subDistrict
- self.user_company_id.zip_merchant = self.merchant_id.zip
- self.user_company_id.bank_name_merchant = self.merchant_id.bank_name
- self.user_company_id.rekening_name_merchant = self.merchant_id.rekening_name
- self.user_company_id.account_number_merchant = self.merchant_id.account_number
- self.user_company_id.email_company_merchant = self.merchant_id.email_company
- self.user_company_id.email_sales_merchant = self.merchant_id.email_sales
- self.user_company_id.email_finance_merchant = self.merchant_id.email_finance
- self.user_company_id.phone_merchant = self.merchant_id.phone
- self.user_company_id.mobile_merchant = self.merchant_id.mobile
- self.user_company_id.bisnis_type = self.merchant_id.bisnis_type
- self.user_company_id.website_merchant = self.merchant_id.website
- self.user_company_id.category_perusahaan = self.merchant_id.category_perusahaan
-
- # Informasi Vendor
- self.user_company_id.harga_tayang = self.merchant_id.harga_tayang
- self.user_company_id.category_produk_ids_merchant = self.merchant_id.category_produk_ids
- self.user_company_id.merk_dagang = self.merchant_id.merk_dagang
- self.user_company_id.is_pengajuan_tempo = self.merchant_id.is_pengajuan_tempo
- self.user_company_id.tempo_duration_merchant = self.merchant_id.tempo_duration
- self.user_company_id.kredit_limit = self.merchant_id.kredit_limit
- self.user_company_id.waktu_pengiriman = self.merchant_id.waktu_pengiriman
- self.user_company_id.terhitung_sejak = self.merchant_id.terhitung_sejak
-
- # Syarat Perdagangan
- self.user_company_id.is_kembali_barang = self.merchant_id.is_kembali_barang
- self.user_company_id.tenggat_waktu = self.merchant_id.tenggat_waktu
- self.user_company_id.sertifikat_produk = self.merchant_id.sertifikat_produk
- self.user_company_id.tempo_garansi = self.merchant_id.tempo_garansi
- self.user_company_id.explain_garansi = self.merchant_id.explain_garansi
- self.user_company_id.is_order_quantity = self.merchant_id.is_order_quantity
-
- # Dokumen
- self.user_company_id.file_npwp = self.merchant_id.file_npwp
- self.user_company_id.file_sppkp = self.merchant_id.file_sppkp
- self.user_company_id.file_dokumenKtpDirut = self.merchant_id.file_dokumenKtpDirut
- self.user_company_id.file_kartuNama = self.merchant_id.file_kartuNama
- self.user_company_id.file_suratPernyataan = self.merchant_id.file_suratPernyataan
- self.user_company_id.file_fotoKantor = self.merchant_id.file_fotoKantor
- self.user_company_id.file_dataProduk = self.merchant_id.file_dataProduk
- self.user_company_id.file_pricelist = self.merchant_id.file_pricelist
- self.user_company_id.description = self.merchant_id.description
-
- return super(UserMerchantRequest, self).write(vals) \ No newline at end of file