mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX]contract_count == len(active contracts)
This commit is contained in:
committed by
Denis Roussel
parent
e7180f7e72
commit
e065a99d3c
@@ -103,7 +103,9 @@ class SaleOrder(models.Model):
|
||||
@api.depends("order_line")
|
||||
def _compute_contract_count(self):
|
||||
for rec in self:
|
||||
rec.contract_count = len(rec.order_line.mapped('contract_id'))
|
||||
rec.contract_count = len(
|
||||
rec.order_line.mapped('contract_id').filtered(
|
||||
lambda r: r.active))
|
||||
|
||||
@api.multi
|
||||
def action_show_contracts(self):
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<button name="action_show_contracts"
|
||||
type="object" icon="fa-book"
|
||||
class="oe_stat_button"
|
||||
attrs="{'invisible': ['|', ('is_contract', '!=', True), ('state', 'not in', ['sale', 'done'])]}">
|
||||
attrs="{'invisible': ['|', '|', ('is_contract', '!=', True), ('state', 'not in', ['sale', 'done']), ('contract_count', '=', 0)]}">
|
||||
<field string="Contracts"
|
||||
name="contract_count"
|
||||
widget="statinfo"/>
|
||||
|
||||
Reference in New Issue
Block a user