From f0a6ae0f036a6fa598990b66931af894d58f3eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Wed, 27 Apr 2016 19:30:32 +0200 Subject: [PATCH] [FIX] mis_builder: fix date type for fiscal year date start computation plus a bit of pep 8 and idiom to get ids from a recordset --- mis_builder/models/aep.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mis_builder/models/aep.py b/mis_builder/models/aep.py index 0314b8ca..7b53d372 100644 --- a/mis_builder/models/aep.py +++ b/mis_builder/models/aep.py @@ -5,6 +5,7 @@ import re from collections import defaultdict +from openerp import fields from openerp.models import expression from openerp.tools.safe_eval import safe_eval from .accounting_none import AccountingNone @@ -81,12 +82,12 @@ class AccountingExpressionProcessor(object): if account_code is None: # None means we want all accounts account_ids = account_model.\ - search([]).mapped('id') + search([]).ids self._account_ids_by_code[account_code].update(account_ids) elif '%' in account_code: account_ids = account_model.\ search([('code', 'like', account_code), - ('company_id', '=', company.id)]).mapped('id') + ('company_id', '=', company.id)]).ids self._account_ids_by_code[account_code].update(account_ids) else: # search exact codes after the loop to do less queries @@ -186,8 +187,9 @@ class AccountingExpressionProcessor(object): else: # for income and expense account, get balance from the beginning # of the current fiscal year + date_from_date = fields.Date.from_string(date_from) fy_date_from = \ - company.compute_fiscalyear_dates(date_from)['date_from'] + company.compute_fiscalyear_dates(date_from_date)['date_from'] domain = ['|', ('date', '>=', fy_date_from), ('account_id.user_type_id.include_initial_balance', '=',