From d3538371691a43efbd5527b746c942bdef9fd1ba Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Sat, 7 Jun 2025 11:02:03 +0700 Subject: (andri) Pada PO, CAB tidak tampil jika statusnya bukan posted --- indoteknik_custom/models/purchase_order.py | 8 ++++++++ indoteknik_custom/views/purchase_order.xml | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 27f1aebd..004a1fa4 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -89,6 +89,14 @@ 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') + is_cab_visible = fields.Boolean(string='Tampilkan Tombol CAB', compute='_compute_is_cab_visible') + + @api.depends('move_id.state') + def _compute_is_cab_visible(self): + for order in self: + move = order.move_id + order.is_cab_visible = bool(move and move.state == 'posted') + def action_view_journal_uangmuka(self): self.ensure_one() if not self.move_id: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 12ad6864..a78f300c 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -15,11 +15,12 @@ /> +