Skip to content

Commit

Permalink
Merge 890e472 into be32b21
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpeiffer committed Apr 26, 2016
2 parents be32b21 + 890e472 commit d718447
Show file tree
Hide file tree
Showing 34 changed files with 857 additions and 785 deletions.
12 changes: 8 additions & 4 deletions account_financial_report_webkit/report/aged_partner_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,14 @@ def compute_delay_from_partial_rec(self, line, end_date, ledger_lines):
:returns: delta in days
"""
sale_lines = [x for x in ledger_lines if x['jtype'] in REC_PAY_TYPE
and line['rec_id'] == x['rec_id']]
refund_lines = [x for x in ledger_lines if x['jtype'] in REFUND_TYPE
and line['rec_id'] == x['rec_id']]
sale_lines = [
x for x in ledger_lines if x['jtype'] in REC_PAY_TYPE and
line['rec_id'] == x['rec_id']
]
refund_lines = [
x for x in ledger_lines if x['jtype'] in REFUND_TYPE and
line['rec_id'] == x['rec_id']
]
if len(sale_lines) == 1:
reference_line = sale_lines[0]
elif len(refund_lines) == 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ def compute_partner_balance_data(self, data, filter_report_type=None):

for partner_id, partner_values in \
values['partners_amounts'].copy().iteritems():
base_partner_balance = partners_amounts_accounts[account.id][partner_id]['balance']\
partners_amounts_account =\
partners_amounts_accounts[account.id]
base_partner_balance =\
partners_amounts_account[partner_id]['balance']\
if partners_amounts_accounts.get(account.id)\
and partners_amounts_accounts.get(account.id)\
.get(partner_id) else 0.0
Expand Down
7 changes: 4 additions & 3 deletions account_financial_report_webkit/report/common_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ def sort_accounts_with_structure(self, root_account_ids, account_ids,
def recursive_sort_by_code(accounts, parent):
sorted_accounts = []
# add all accounts with same parent
level_accounts = [account for account in accounts
if account['parent_id']
and account['parent_id'][0] == parent['id']]
level_accounts = [
account for account in accounts
if account['parent_id'] and
account['parent_id'][0] == parent['id']]
# add consolidation children of parent, as they are logically on
# the same level
if parent.get('child_consol_ids'):
Expand Down
4 changes: 2 additions & 2 deletions account_financial_report_webkit/report/open_invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def set_context(self, objects, data, ids, report_type=None):
non_null_init_balances = dict([
(ib, amounts) for ib, amounts
in init_balance[account.id].iteritems()
if amounts['init_balance']
or amounts['init_balance_currency']])
if amounts['init_balance'] or
amounts['init_balance_currency']])
init_bal_lines_pids = non_null_init_balances.keys()

partners_order[account.id] = self._order_partners(
Expand Down
4 changes: 2 additions & 2 deletions account_financial_report_webkit/report/partners_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def set_context(self, objects, data, ids, report_type=None):
non_null_init_balances = dict(
[(ib, amounts) for ib, amounts
in init_balance[account.id].iteritems()
if amounts['init_balance']
or amounts['init_balance_currency']])
if amounts['init_balance'] or
amounts['init_balance_currency']])
init_bal_lines_pids = non_null_init_balances.keys()
else:
init_balance[account.id] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from mako.template import Template
from mako.lookup import TemplateLookup

import os
import subprocess
import tempfile
Expand Down Expand Up @@ -75,8 +78,6 @@

# redefine mako_template as this is overriden by jinja since saas-1
# from openerp.addons.report_webkit.webkit_report import mako_template
from mako.template import Template
from mako.lookup import TemplateLookup


def mako_template(text):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def generate_xls_report(self, _p, _xs, data, objects, wb):
display_initial_balance = _p['init_balance'][account.id] and \
(_p['init_balance'][account.id].get(
'debit', 0.0) != 0.0 or
_p['init_balance'][account.id].get('credit', 0.0)
!= 0.0)
_p['init_balance'][account.id].get('credit', 0.0) != 0.0)
display_ledger_lines = _p['ledger_lines'][account.id]

if _p.display_account_raw(data) == 'all' or \
Expand Down
34 changes: 18 additions & 16 deletions account_financial_report_webkit_xls/report/open_invoices_xls.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ def print_row_code_account(self, regroupmode, account, row_position,
partner_name):
if regroupmode == "regroup":
c_specs = [('acc_title', self.nbr_columns, 0, 'text',
' - '.join([account.code, account.name, partner_name
or _('No partner')])), ]
' - '.join([account.code,
account.name,
partner_name or _('No partner')])), ]
else:
c_specs = [
('acc_title', self.nbr_columns, 0, 'text', ' - '.
Expand Down Expand Up @@ -332,10 +333,10 @@ def print_lines(self, row_position, account, line, _p, data, line_number):
else:
c_specs += [('datedue', 1, 0, 'text', None)]
c_specs += [
('debit', 1, 0, 'number', line.get('debit')
or 0.0, None, style_line_decimal),
('credit', 1, 0, 'number', line.get('credit')
or 0.0, None, style_line_decimal),
('debit', 1, 0, 'number', line.get('debit') or 0.0, None,
style_line_decimal),
('credit', 1, 0, 'number', line.get('credit') or 0.0, None,
style_line_decimal),
]

# determine the formula of the cumulated balance
Expand All @@ -357,8 +358,9 @@ def print_lines(self, row_position, account, line, _p, data, line_number):
if _p.amount_currency(data):
if account.currency_id:
c_specs += [
('curramount', 1, 0, 'number', line.get('amount_currency')
or 0.0, None, style_line_decimal),
('curramount', 1, 0, 'number',
line.get('amount_currency') or 0.0, None,
style_line_decimal),
('currcode', 1, 0, 'text', line[
'currency_code'], None, style_line_right),
]
Expand Down Expand Up @@ -428,18 +430,18 @@ def print_group_lines(self, row_position, account, line, _p, line_number):
else:
c_specs += [('datedue', 1, 0, 'text', None)]
c_specs += [
('debit', 1, 0, 'number', line.get('debit')
or 0.0, None, style_line_decimal),
('credit', 1, 0, 'number', line.get('credit')
or 0.0, None, style_line_decimal),
('debit', 1, 0, 'number', line.get('debit') or 0.0, None,
style_line_decimal),
('credit', 1, 0, 'number', line.get('credit') or 0.0, None,
style_line_decimal),
('cumul', 1, 0, 'number', None, cumul_balance, style_line_decimal),
]
if account.currency_id:
c_specs += [
('curramount', 1, 0, 'number', line.get('amount_currency')
or 0.0, None, style_line_decimal),
('currcode', 1, 0, 'text', line.get('currency_code')
or '', None, style_line_right),
('curramount', 1, 0, 'number',
line.get('amount_currency') or 0.0, None, style_line_decimal),
('currcode', 1, 0, 'text',
line.get('currency_code') or '', None, style_line_right),
]
else:
c_specs += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ def print_comparison_header(self, _xs, xlwt, row_position, _p, ws,
('c', 2, 0, 'text', _('Comparison') + str(index + 1) +
' (C' + str(index + 1) + ')')]
if params['comparison_filter'] == 'filter_date':
c_specs += [('f', 2, 0, 'text', _('Dates Filter') + ': ' +
_p.formatLang(params['start'], date=True) + ' - '
+ _p.formatLang(params['stop'], date=True))]
c_specs += [
('f', 2, 0, 'text',
_('Dates Filter') + ': ' +
_p.formatLang(params['start'], date=True) + ' - ' +
_p.formatLang(params['stop'], date=True))]
elif params['comparison_filter'] == 'filter_period':
c_specs += [('f', 2, 0, 'text', _('Periods Filter') +
': ' + params['start'].name + ' - ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ def generate_xls_report(self, _p, _xs, data, objects, wb):
('diff', 1, 0, 'number', comp_account[
'diff'], None, cell_style_decimal),
('diff_percent', 1, 0, 'number', comp_account[
'percent_diff'] and comp_account['percent_diff']
or 0, None, cell_style_pct),
'percent_diff'] and
comp_account['percent_diff'] or 0, None,
cell_style_pct),
]

c_specs += [('type', 1, 0, 'text',
Expand Down
18 changes: 8 additions & 10 deletions account_journal_report_xls/report/nov_account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def _lines(self, object):
"rc.symbol AS currency_symbol, "
"coalesce(ai.internal_number,'-') AS inv_number, "
"coalesce(abs.name,'-') AS st_number, "
"coalesce(av.number,'-') AS voucher_number "
+ select_extra +
"coalesce(av.number,'-') AS voucher_number " +
select_extra +
"FROM account_move_line l "
"INNER JOIN account_move am ON l.move_id = am.id "
"INNER JOIN account_account aa "
Expand All @@ -192,11 +192,9 @@ def _lines(self, object):
"LEFT OUTER JOIN account_analytic_account ana "
"ON l.analytic_account_id = ana.id "
"LEFT OUTER JOIN res_currency rc "
"ON l.currency_id = rc.id "
+ join_extra +
"ON l.currency_id = rc.id " + join_extra +
"WHERE l.period_id IN %s AND l.journal_id = %s "
"AND am.state IN %s "
+ where_extra +
"AND am.state IN %s " + where_extra +
"ORDER BY " + self.sort_selection +
", move_date, move_id, acc_code",
(tuple(period_ids), journal_id,
Expand All @@ -206,12 +204,12 @@ def _lines(self, object):
# add reference of corresponding origin document
if journal.type in ('sale', 'sale_refund', 'purchase',
'purchase_refund'):
[x.update({'docname': (_('Invoice') + ': ' + x['inv_number'])
or (_('Voucher') + ': ' + x['voucher_number']) or '-'})
[x.update({'docname': (_('Invoice') + ': ' + x['inv_number']) or
(_('Voucher') + ': ' + x['voucher_number']) or '-'})
for x in lines]
elif journal.type in ('bank', 'cash'):
[x.update({'docname': (_('Statement') + ': ' + x['st_number'])
or (_('Voucher') + ': ' + x['voucher_number']) or '-'})
[x.update({'docname': (_('Statement') + ': ' + x['st_number']) or
(_('Voucher') + ': ' + x['voucher_number']) or '-'})
for x in lines]
else:
code_string = j_obj._report_xls_document_extra(
Expand Down
10 changes: 10 additions & 0 deletions mis_builder/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ analytic accounts.
Known issues / Roadmap
======================

* V9 thoughts:
* select accounts by tag (see also select accounts by type below)
* how to handle multi-company consolidation now that consolidation children are gone?
* what replaces root accounts / account charts in v9? nothing it seems, so
we are limited to one chart of accounts per company;
* for multi-company consolidation, must we replace the consolidation chart
of account by a list of companies?

* Add 'Fiscal Year' period type.

* Allow selecting accounts by type. This is currently possible by expressing
a query such as balp[][('account_id.user_type.code', '=', ...)]. This will work
but would be more efficient if one could write balp[user_type=...], as it would
involve much less queries to the database.
Possible syntax could be balp[code:60%,70%], balp[type:...], balp[tag:...],
with code: being optional and the default.

* More tests should be added. The first part is creating test data, then it will be
easier. At the minimum, We need the following test data:
Expand Down
26 changes: 3 additions & 23 deletions mis_builder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# mis_builder module for Odoo, Management Information System Builder
# Copyright (C) 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
#
# This file is a part of mis_builder
#
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# mis_builder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License v3 or later for more details.
#
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
from . import wizard
Expand Down
32 changes: 6 additions & 26 deletions mis_builder/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# mis_builder module for Odoo, Management Information System Builder
# Copyright (C) 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
#
# This file is a part of mis_builder
#
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# mis_builder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License v3 or later for more details.
#
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'MIS Builder',
'version': '8.0.0.2.0',
'version': '9.0.1.0.0',
'category': 'Reporting',
'summary': """
Build 'Management Information System' Reports and Dashboards
Expand All @@ -34,7 +14,7 @@
'website': 'http://acsone.eu',
'depends': [
'account',
'report_xls', # OCA/reporting-engine
'report_xlsx', # OCA/reporting-engine
],
'data': [
'wizard/mis_builder_dashboard.xml',
Expand All @@ -55,7 +35,7 @@
'qweb': [
'static/src/xml/*.xml'
],
'installable': False,
'installable': True,
'application': True,
'auto_install': False,
'license': 'AGPL-3',
Expand Down
2 changes: 1 addition & 1 deletion mis_builder/migrations/8.0.0.2/pre-migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# mis_builder module for Odoo, Management Information System Builder
Expand Down
26 changes: 3 additions & 23 deletions mis_builder/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# mis_builder module for Odoo, Management Information System Builder
# Copyright (C) 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
#
# This file is a part of mis_builder
#
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# mis_builder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License v3 or later for more details.
#
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import mis_builder
from . import aep
Loading

0 comments on commit d718447

Please sign in to comment.