summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-06-07 11:02:03 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-06-07 11:02:03 +0700
commitd3538371691a43efbd5527b746c942bdef9fd1ba (patch)
tree1deefef8605e80436a68f53ceedc3aeb5eb546e8
parent55fb073416a7f8504c3819178aa7b6883304335f (diff)
(andri) Pada PO, CAB tidak tampil jika statusnya bukan posted
-rwxr-xr-xindoteknik_custom/models/purchase_order.py8
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml5
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 @@
/>
</div>
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
+ <field name="is_cab_visible" invisible="1"/>
<button type="object"
name="action_view_journal_uangmuka"
class="oe_stat_button"
icon="fa-book"
- attrs="{'invisible':[('move_id','=',False)]}"
+ attrs="{'invisible': [('is_cab_visible', '=', False)]}"
style="width: 200px;">
<field name="move_id" widget="statinfo" string="Journal Uang Muka"/>
<span class="o_stat_text">
@@ -78,7 +79,7 @@
<field name="total_cost_service" attrs="{'required': [('partner_id', 'in', [9688, 29712])]}"/>
<field name="total_delivery_amt" attrs="{'required': [('partner_id', 'in', [9688, 29712])]}"/>
<field name="product_bom_id"/>
- <field name="move_id" domain="[('move_type','=','entry')]" context="{'form_view_ref': 'account.view_move_form'}" options="{'no_create': True}"/>
+ <!-- <field name="move_id" domain="[('move_type','=','entry')]" context="{'form_view_ref': 'account.view_move_form'}" options="{'no_create': True}"/> -->
</field>
<field name="amount_total" position="after">
<field name="total_margin"/>