From 2fe077d802bf143b110bc681ac039ba8bcfccb26 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 17 Jul 2025 13:57:47 +0700 Subject: (andri) init action dll --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/down_payment.py | 49 ++++++++++++--- indoteknik_custom/security/ir.model.access.csv | 1 + indoteknik_custom/views/down_payment.xml | 87 ++++++++++++++++++++++++++ indoteknik_custom/views/ir_sequence.xml | 10 +++ 6 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 indoteknik_custom/views/down_payment.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 21afc26f..7539f23f 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -170,6 +170,7 @@ 'views/public_holiday.xml', 'views/stock_inventory.xml', 'views/sale_order_delay.xml', + 'views/down_payment.xml', ], 'demo': [], 'css': [], diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index b815b472..1c54efc6 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -153,3 +153,4 @@ from . import sale_order_delay from . import approval_invoice_date from . import approval_payment_term # from . import patch +from . import down_payment diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py index 8b57bc2f..7a3a39f1 100644 --- a/indoteknik_custom/models/down_payment.py +++ b/indoteknik_custom/models/down_payment.py @@ -5,13 +5,17 @@ from datetime import datetime import logging from terbilang import Terbilang import pytz +from pytz import timezone class DownPayment(models.Model): _name = 'down.payment' _description = 'Down Payment Management' + _rec_name = 'number' - number = fields.Char(string='No. Dokumen', required=True, tracking=3) + user_id = fields.Many2one('res.users', string='Diajukan Oleh', default=lambda self: self.env.user, tracking=3) + + number = fields.Char(string='No. Dokumen', default='New Draft', tracking=3) applicant_name = fields.Char(string='Nama Pemohon', tracking=3, required=True) nominal = fields.Float(string='Nominal', tracking=3, required=True) @@ -23,12 +27,12 @@ class DownPayment(models.Model): status = fields.Selection([ ('draft', 'Draft'), - ('pengajuan1', 'Approval Departement'), - ('pengajuan2', 'Approval AP'), - ('pengajuan3', 'Approval Pimpinan'), + ('pengajuan1', 'Menunggu Approval Departement'), + ('pengajuan2', 'Menunggu Pengecekan AP'), + ('pengajuan3', 'Menunggu Approval Pimpinan'), ('approved', 'Approved'), ('reject', 'Rejected') - ], string='Status Down Payment', default='draft', tracking=3) + ], string='Status', default='draft', tracking=3, index=True, track_visibility='onchange') status_pay_down_payment = fields.Selection([ ('pending', 'Pending'), @@ -37,7 +41,7 @@ class DownPayment(models.Model): departement_type = fields.Selection([ ('sales', 'Sales'), - ('md', 'MD'), + ('merchandiser', 'Merchandiser'), ('marketing', 'Marketing'), ('logistic', 'Logistic'), ('procurement', 'Procurement'), @@ -53,24 +57,50 @@ class DownPayment(models.Model): # --------------------------------------- # AP : Manzila (Finance) ID 23 - created_date = fields.Datetime(string='Created Date', default=lambda self: fields.Datetime.now(), tracking=3) + def action_realisasi_pum(self): + self.ensure_one() + # Logic untuk realisasi PUM + return + + def action_confirm_payment(self): + self.ensure_one() + # Logic untuk konfirmasi pembayaran + return + + def action_reject(self): + self.ensure_one() + # Logic untuk konfirmasi pembayaran + return + + def action_approval_check(self): + self.ensure_one() + # Logic untuk konfirmasi pembayaran + return + + @api.model + def create(self, vals): + if not vals.get('number') or vals['number'] == 'New Draft': + vals['number'] = self.env['ir.sequence'].next_by_code('down.payment') or 'New Draft' + return super(DownPayment, self).create(vals) + class RealizationDownPayment(models.Model): _name = 'realization.down.payment' _description = 'Realization Down Payment Management' + # number = fields.Char(string='No. Dokumen', tracking=3) title = fields.Char(string='Judul', required=True, tracking=3) goals = fields.Text(string='Tujuan', tracking=3, required=True) related = fields.Char(string='Terkait', tracking=3, required=True) - # Rincian Pemberian PUM + # Page Rincian Pemberian PUM date_line = fields.Date(string='Tanggal', required=True, tracking=3, default=lambda self: fields.Date.today()) info_line = fields.Char(string='Description', required=True, tracking=3) value_line = fields.Float(string='Nilai', required=True, tracking=3) grand_total = fields.Float(string='Grand Total', tracking=3) - # Rincian Penggunaan PUM + # Page Rincian Penggunaan PUM date_line_use = fields.Date(string='Tanggal', required=True, tracking=3, default=lambda self: fields.Date.today()) info_line_use = fields.Char(string='Description', required=True, tracking=3) value_line_use = fields.Float(string='Nominal', required=True, tracking=3) @@ -88,6 +118,7 @@ class RealizationDownPayment(models.Model): + diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 2b970cfd..c4347709 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -183,3 +183,4 @@ access_production_purchase_match,access.production.purchase.match,model_producti access_image_carousel,access.image.carousel,model_image_carousel,,1,1,1,1 access_v_sale_notin_matchpo,access.v.sale.notin.matchpo,model_v_sale_notin_matchpo,,1,1,1,1 access_approval_payment_term,access.approval.payment.term,model_approval_payment_term,,1,1,1,1 +access_down_payment,access.down.payment,model_down_payment,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/down_payment.xml b/indoteknik_custom/views/down_payment.xml new file mode 100644 index 00000000..f418b932 --- /dev/null +++ b/indoteknik_custom/views/down_payment.xml @@ -0,0 +1,87 @@ + + + + down.payment.form + down.payment + +
+
+
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + down.payment.tree + down.payment + + + + + + + + + + + + + + Pengajuan Uang Muka (Down Payment) + ir.actions.act_window + down.payment + tree,form + + + +
\ No newline at end of file diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml index f2b42c3b..e959f562 100644 --- a/indoteknik_custom/views/ir_sequence.xml +++ b/indoteknik_custom/views/ir_sequence.xml @@ -200,5 +200,15 @@ 1 1 + + + Down Payment Sequence + down.payment + PUM/%(year)s/ + 5 + 1 + 1 + True + \ No newline at end of file -- cgit v1.2.3