diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-07-15 13:20:58 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-07-15 13:20:58 +0700 |
| commit | f3fc6d3d1a4c5ac0b287e3bb7e1163b99393c728 (patch) | |
| tree | 10512f61983acfef166995f527afdfc7a4ddf802 | |
| parent | 847579fd0b1a846e89646ad270a920d124abaa5a (diff) | |
(andri) fix
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 16 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 6901ecb6..f98a37be 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -668,16 +668,16 @@ class PurchaseOrder(models.Model): resposible_ids = list(set(resposible_ids)) purchase.responsible_ids = resposible_ids - # def _compute_has_active_invoice(self): - # for order in self: - # order.has_active_invoice = any(invoice.state != 'cancel' for invoice in order.invoice_ids) - def _compute_has_active_invoice(self): for order in self: - related_invoices = order.invoice_ids.filtered( - lambda inv: inv.purchase_order_id.id == order.id and inv.move_type == 'in_invoice' and inv.state != 'cancel' - ) - order.has_active_invoice = bool(related_invoices) + order.has_active_invoice = any(invoice.state != 'cancel' for invoice in order.invoice_ids) + + # def _compute_has_active_invoice(self): + # for order in self: + # related_invoices = order.invoice_ids.filtered( + # lambda inv: inv.purchase_order_id.id == order.id and inv.move_type == 'in_invoice' and inv.state != 'cancel' + # ) + # order.has_active_invoice = bool(related_invoices) def add_product_to_pricelist(self): i = 0 diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index fa8d40d5..dae23eed 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -164,7 +164,7 @@ </field> <field name="order_line" position="attributes"> - <attribute name="attrs">{'readonly': ['&', ('state', 'in', ['purchase', 'done', 'cancel']), ('has_active_invoice', '=', True)]}</attribute> + <attribute name="attrs">{'readonly': ['|', ('state', 'in', ['purchase', 'done', 'cancel']), ('has_active_invoice', '=', True)]}</attribute> </field> <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="attributes"> |
