diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-20 10:53:20 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-20 10:53:20 +0700 |
| commit | ee81bf8bd22dc3c2431554b7302071b725fe3e90 (patch) | |
| tree | 4bfbb078a0377fad87661e097762d70c7fbe9eb2 | |
| parent | 1d44c04f3ec25d3adc19eb8e34589c6461ef8a66 (diff) | |
(andri) add button bills DP & Pelunasan
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 32 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 6 |
2 files changed, 38 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 103a9131..50913a80 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -103,6 +103,11 @@ class PurchaseOrder(models.Model): string="BU Related Count", compute='_compute_bu_related_count' ) + + bills_related_count = fields.Integer( + string="Bills DP & Pelunasan", + compute="_compute_bills_related_count" + ) manufacturing_id = fields.Many2one('mrp.production', string='Manufacturing Orders') complete_bu_in_count = fields.Integer( @@ -260,6 +265,33 @@ class PurchaseOrder(models.Model): 'target': 'current', } + def action_view_bills(self): + self.ensure_one() + + bill_ids = [] + if self.bills_dp_id: + bill_ids.append(self.bills_dp_id.id) + if self.bills_pelunasan_id: + bill_ids.append(self.bills_pelunasan_id.id) + + return { + 'name': 'Bills (DP & Pelunasan)', + 'type': 'ir.actions.act_window', + 'res_model': 'account.move', + 'view_mode': 'tree,form', + 'target': 'current', + 'domain': [('id', 'in', bill_ids)], + } + + def _compute_bills_related_count(self): + for order in self: + count = 0 + if order.bills_dp_id: + count += 1 + if order.bills_pelunasan_id: + count += 1 + order.bills_related_count = count + # 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 15cdc788..57cfdfca 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -36,6 +36,12 @@ <field name="bu_related_count" widget="statinfo" string="BU Related"/> </button> <field name="picking_count" invisible="1"/> + <button name="action_view_bills" + type="object" + icon="fa-pencil-square-o"> + <field string="Bills DP & Pelunasan" name="bills_related_count" widget="statinfo" + attrs="{'invisible': [('bills_dp_id', '=', False)]}"/> + </button> </xpath> <button id="draft_confirm" position="after"> <button name="po_approve" |
