From fa2c8cc7b00e963e740307484c174961f61ffc84 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 5 Jun 2025 08:35:39 +0700 Subject: (andri) add field Journal Uang Muka di PO dan Purchase Order pada CAB --- indoteknik_custom/models/account_move.py | 11 +++++++++++ indoteknik_custom/models/purchase_order.py | 2 +- indoteknik_custom/models/uangmuka_pembelian.py | 2 ++ indoteknik_custom/views/account_move.xml | 1 + indoteknik_custom/views/purchase_order.xml | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 30de67be..24cedc34 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -68,6 +68,17 @@ class AccountMove(models.Model): purchase_order_id = fields.Many2one('purchase.order', string='Purchase Order') length_of_payment = fields.Integer(string="Length of Payment", compute='compute_length_of_payment') + def name_get(self): + result = [] + for move in self: + if move.move_type == 'entry': + # Tampilkan nomor CAB (name) + result.append((move.id, move.name)) + else: + # Gunakan default display + result.append((move.id, move.display_name)) + return result + def compute_length_of_payment(self): for rec in self: payment_term = rec.invoice_payment_term_id.line_ids[0].days diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 240289bf..0696dd9f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -65,7 +65,7 @@ class PurchaseOrder(models.Model): sale_order = fields.Char(string='Sale Order') matches_so = fields.Many2many('sale.order', string='Matches SO', compute='_compute_matches_so') is_create_uangmuka = fields.Boolean(string='Uang Muka?') - move_id = fields.Many2one('account.move', string='Account Move') + move_id = fields.Many2one('account.move', string='Journal Entries Uang Muka', domain=[('move_type', '=', 'entry')]) logbook_bill_id = fields.Many2one('report.logbook.bill', string='Logbook Bill') status_printed = fields.Selection([ ('not_printed', 'Belum Print'), diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py index ba41f814..13d51dcf 100644 --- a/indoteknik_custom/models/uangmuka_pembelian.py +++ b/indoteknik_custom/models/uangmuka_pembelian.py @@ -57,6 +57,8 @@ class UangmukaPembelian(models.TransientModel): account_move = request.env['account.move'].create([param_header]) _logger.info('Success Create Uang Muka Pembelian %s' % account_move.name) + account_move.purchase_order_id = order.id # isi field purchase_order_id + if order.partner_id.parent_id: partner_id = order.partner_id.parent_id.id else: diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 46737a40..9217cc2a 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -31,6 +31,7 @@ + diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 0fbbb5e7..99362798 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -65,6 +65,7 @@ + -- cgit v1.2.3 From c43cba9dd205a3f08343f79233d3af6f5ab189ff Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 5 Jun 2025 08:47:31 +0700 Subject: (andri) penyesuaian value field CAB ketika masi dalam keadaan draft --- indoteknik_custom/models/account_move.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 24cedc34..29368089 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -72,10 +72,14 @@ class AccountMove(models.Model): result = [] for move in self: if move.move_type == 'entry': - # Tampilkan nomor CAB (name) - result.append((move.id, move.name)) + # Jika masih draft, tampilkan 'Draft CAB' + if move.state == 'draft': + label = 'Draft CAB' + else: + label = move.name + result.append((move.id, label)) else: - # Gunakan default display + # Untuk invoice dan lainnya, pakai default result.append((move.id, move.display_name)) return result -- cgit v1.2.3 From 55fb073416a7f8504c3819178aa7b6883304335f Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 5 Jun 2025 10:53:30 +0700 Subject: (andri) merubah peletakan CAB menjadi berada di atas sebelah tombol receipt --- indoteknik_custom/models/purchase_order.py | 14 ++++++++++++++ indoteknik_custom/views/purchase_order.xml | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 0696dd9f..27f1aebd 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -89,6 +89,20 @@ class PurchaseOrder(models.Model): store_name = fields.Char(string='Nama Toko') purchase_order_count = fields.Integer('Purchase Order Count', related='partner_id.purchase_order_count') + def action_view_journal_uangmuka(self): + self.ensure_one() + if not self.move_id: + raise UserError("Journal Uang Muka belum tersedia.") + + return { + 'type': 'ir.actions.act_window', + 'name': 'Journal Entry', + 'res_model': 'account.move', + 'res_id': self.move_id.id, + 'view_mode': 'form', + 'target': 'current', + } + # cek payment term def _check_payment_term(self): _logger.info("Check Payment Term Terpanggil") diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 99362798..12ad6864 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -14,6 +14,19 @@ attrs="{'invisible': ['|', ('sale_order_id', '=', False), ('state', 'not in', ['draft'])]}" /> + + +