mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
Merge pull request #354 from NL66278/10.0-contract_count
[10.0][FIX] contract. Prevent wrong contract count.
This commit is contained in:
@@ -14,13 +14,14 @@ class ResPartner(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _compute_contract_count(self):
|
def _compute_contract_count(self):
|
||||||
Contract = self.env['account.analytic.account']
|
contract_model = self.env['account.analytic.account']
|
||||||
today = fields.Date.today()
|
# localized date is also the default for date_start.
|
||||||
|
today = fields.Date.context_today(contract_model)
|
||||||
for partner in self:
|
for partner in self:
|
||||||
partner.contract_count = Contract.search_count([
|
partner.contract_count = contract_model.search_count([
|
||||||
('recurring_invoices', '=', True),
|
('recurring_invoices', '=', True),
|
||||||
('partner_id', '=', partner.id),
|
('partner_id', '=', partner.id),
|
||||||
('date_start', '<=', today),
|
('date_start', '<=', today), # required for contracts
|
||||||
'|',
|
'|',
|
||||||
('date_end', '=', False),
|
('date_end', '=', False),
|
||||||
('date_end', '>=', today),
|
('date_end', '>=', today),
|
||||||
|
|||||||
Reference in New Issue
Block a user