diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-08-20 04:38:14 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-08-20 04:38:14 +0000 |
| commit | 6b5904e694024c39298a376beed47c2fe0a56310 (patch) | |
| tree | 17c851d64b847973d096a873f31da013836bdc1b | |
| parent | 5c9a90401081813e7d06ab3dede8fd4ed50f06e1 (diff) | |
| parent | 17a865cf95cc6e53021a12b05df907ff8d1a06de (diff) | |
Merged in bill-dp-pelunasan (pull request #390)
Bill dp pelunasan
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 32 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 26 |
2 files changed, 49 insertions, 9 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..821f3295 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -14,6 +14,16 @@ attrs="{'invisible': ['|', ('sale_order_id', '=', False), ('state', 'not in', ['draft'])]}" /> </div> + <xpath expr="//button[@name='action_view_invoice']" position="after"> + <button type="object" + name="action_view_related_bu" + class="oe_stat_button" + icon="fa-truck" + attrs="{'invisible': [('state', 'in', ['draft', 'sent'])]}"> + <field name="bu_related_count" widget="statinfo" string="BU Related"/> + </button> + <field name="picking_count" invisible="1"/> + </xpath> <xpath expr="//button[@name='action_view_invoice']" position="before"> <field name="is_cab_visible" invisible="1"/> <button type="object" @@ -21,21 +31,19 @@ class="oe_stat_button" icon="fa-book" attrs="{'invisible': [('is_cab_visible', '=', False)]}" - style="width: 200px;"> + > <field name="move_id" widget="statinfo" string="Journal Uang Muka"/> <span class="o_stat_text"> <t t-esc="record.move_id.name"/> </span> </button> - <button type="object" - name="action_view_related_bu" - class="oe_stat_button" - icon="fa-truck" - style="width: 200px;" - attrs="{'invisible': [('state', 'in', ['draft', 'sent'])]}"> - <field name="bu_related_count" widget="statinfo" string="BU Related"/> + <button name="action_view_bills" + type="object" + icon="fa-pencil-square-o" + attrs="{'invisible': [ + ('bills_related_count', '=', 0)]}"> + <field string="Bills DP & Pelunasan" name="bills_related_count" widget="statinfo"/> </button> - <field name="picking_count" invisible="1"/> </xpath> <button id="draft_confirm" position="after"> <button name="po_approve" |
