-
-
-
\ No newline at end of file
diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py
index 60f591fcb55..972373f87af 100644
--- a/addons/account/project/wizard/__init__.py
+++ b/addons/account/project/wizard/__init__.py
@@ -24,8 +24,7 @@ import account_analytic_balance_report
import account_analytic_inverted_balance_report
import account_analytic_cost_ledger_report
import account_analytic_cost_ledger_for_journal_report
-import account_analytic_check
import project_account_analytic_line
import account_analytic_chart
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_chart_view.xml b/addons/account/project/wizard/account_analytic_chart_view.xml
index 9cc7a32633b..e4c13a07601 100644
--- a/addons/account/project/wizard/account_analytic_chart_view.xml
+++ b/addons/account/project/wizard/account_analytic_chart_view.xml
@@ -39,7 +39,7 @@
action="action_account_analytic_chart"
id="menu_action_analytic_account_tree2"
icon="STOCK_INDENT"
- groups="base.group_extended"/>
+ groups="analytic.group_analytic_accounting"/>
diff --git a/addons/account/project/wizard/account_analytic_check.py b/addons/account/project/wizard/account_analytic_check.py
deleted file mode 100644
index 53327963151..00000000000
--- a/addons/account/project/wizard/account_analytic_check.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program 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 for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-import time
-
-from osv import osv, fields
-
-class account_analytic_check(osv.osv_memory):
- _name = 'account.analytic.check'
- _description = 'Account Analytic Check'
-
- _columns = {
- 'date1': fields.date('Start of period', required=True),
- 'date2': fields.date('End of period', required=True),
- }
-
- _defaults = {
- 'date1':time.strftime('%Y-01-01'),
- 'date2':time.strftime('%Y-%m-%d')
- }
-
- def check_report(self, cr, uid, ids, context=None):
- datas = {}
- if context is None:
- context = {}
- data = self.read(cr, uid, ids)[0]
- datas = {
- 'ids': context.get('active_ids',[]),
- 'model': 'account.account',
- 'form': data
- }
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'account.analytic.account.analytic.check',
- 'datas': datas,
- }
-
-account_analytic_check()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_check_view.xml b/addons/account/project/wizard/account_analytic_check_view.xml
deleted file mode 100644
index d12acd214a4..00000000000
--- a/addons/account/project/wizard/account_analytic_check_view.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
- Account Analytic Check
- account.analytic.check
- form
-
-
-
-
-
-
- Analytic Check
- ir.actions.act_window
- account.analytic.check
- form
- form
-
- new
-
-
-
-
-
- Account Analytic Check
- client_print_multi
-
- action
- account.account
-
-
-
-
-
diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py
index b58c712d3a2..119c1edef1a 100644
--- a/addons/account/report/account_aged_partner_balance.py
+++ b/addons/account/report/account_aged_partner_balance.py
@@ -34,6 +34,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
self.total_account = []
self.localcontext.update({
'time': time,
+ 'get_lines_with_out_partner': self._get_lines_with_out_partner,
'get_lines': self._get_lines,
'get_total': self._get_total,
'get_direction': self._get_direction,
@@ -130,17 +131,28 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
# Each history will contain : history[1] = {'': }
history = []
for i in range(5):
+ args_list = (tuple(self.ACCOUNT_TYPE), tuple(partner_ids) ,self.date_from,)
+ dates_query = '(COALESCE(date_maturity,date)'
+ if form[str(i)]['start'] and form[str(i)]['stop']:
+ dates_query += ' BETWEEN %s AND %s)'
+ args_list += (form[str(i)]['start'], form[str(i)]['stop'])
+ elif form[str(i)]['start']:
+ dates_query += ' > %s)'
+ args_list += (form[str(i)]['start'],)
+ else:
+ dates_query += ' < %s)'
+ args_list += (form[str(i)]['stop'],)
self.cr.execute('SELECT partner_id, SUM(debit-credit)\
FROM account_move_line AS l, account_account\
WHERE (l.account_id = account_account.id)\
AND (account_account.type IN %s)\
- AND (COALESCE(date_maturity,date) BETWEEN %s AND %s)\
AND (partner_id IN %s)\
AND ((reconcile_id IS NULL)\
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
AND '+ self.query + '\
AND account_account.active\
- GROUP BY partner_id' , (tuple(self.ACCOUNT_TYPE), form[str(i)]['start'], form[str(i)]['stop'], tuple(partner_ids) ,self.date_from,))
+ AND ' + dates_query + '\
+ GROUP BY partner_id' , args_list)
t = self.cr.fetchall()
d = {}
for i in t:
@@ -194,6 +206,113 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
totals[str(i)] += float(r[str(i)] or 0.0)
return res
+ def _get_lines_with_out_partner(self, form):
+ res = []
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ ## mise a 0 du total
+ for i in range(7):
+ self.total_account.append(0)
+ totals = {}
+ self.cr.execute('SELECT SUM(debit-credit) \
+ FROM account_move_line AS l, account_account\
+ WHERE (l.account_id = account_account.id)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND ((reconcile_id IS NULL) \
+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND ' + self.query + '\
+ AND account_account.active ' ,(tuple(self.ACCOUNT_TYPE), self.date_from, ))
+ t = self.cr.fetchall()
+ for i in t:
+ totals['No Partner Defined'] = i[0]
+ future_past = {}
+ if self.direction_selection == 'future':
+ self.cr.execute('SELECT SUM(debit-credit) \
+ FROM account_move_line AS l, account_account\
+ WHERE (l.account_id=account_account.id)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(date_maturity, date) < %s)\
+ AND ((reconcile_id IS NULL)\
+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active ', (tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from, ))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past['No Partner Defined'] = i[0]
+ elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
+ self.cr.execute('SELECT SUM(debit-credit) \
+ FROM account_move_line AS l, account_account\
+ WHERE (l.account_id=account_account.id)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(date_maturity,date) > %s)\
+ AND ((reconcile_id IS NULL)\
+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active ' , (tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past['No Partner Defined'] = i[0]
+ history = []
+ for i in range(5):
+ self.cr.execute('SELECT SUM(debit-credit)\
+ FROM account_move_line AS l, account_account\
+ WHERE (l.account_id = account_account.id)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(date_maturity,date) BETWEEN %s AND %s)\
+ AND ((reconcile_id IS NULL)\
+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active ' , (tuple(self.ACCOUNT_TYPE), form[str(i)]['start'], form[str(i)]['stop'], self.date_from,))
+ t = self.cr.fetchall()
+ d = {}
+ for i in t:
+ d['No Partner Defined'] = i[0]
+ history.append(d)
+
+ values = {}
+ if self.direction_selection == 'future':
+ before = False
+ if future_past.has_key('No Partner Defined'):
+ before = [ future_past['No Partner Defined'] ]
+ self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
+ values['direction'] = before and before[0] or 0.0
+ elif self.direction_selection == 'past':
+ after = False
+ if future_past.has_key('No Partner Defined'):
+ after = [ future_past['No Partner Defined'] ]
+ self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
+ values['direction'] = after and after[0] or ""
+
+ for i in range(5):
+ during = False
+ if history[i].has_key('No Partner Defined'):
+ during = [ history[i]['No Partner Defined'] ]
+ self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
+ values[str(i)] = during and during[0] or ""
+
+ total = False
+ if totals.has_key( 'No Partner Defined' ):
+ total = [ totals['No Partner Defined'] ]
+ values['total'] = total and total[0] or 0.0
+ ## Add for total
+ self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
+ values['name'] = 'No Partner Defined'
+
+ if values['total']:
+ res.append(values)
+
+ total = 0.0
+ totals = {}
+ for r in res:
+ total += float(r['total'] or 0.0)
+ for i in range(5)+['direction']:
+ totals.setdefault(str(i), 0.0)
+ totals[str(i)] += float(r[str(i)] or 0.0)
+ return res
+
def _get_total(self,pos):
period = self.total_account[int(pos)]
return period
diff --git a/addons/account/report/account_aged_partner_balance.rml b/addons/account/report/account_aged_partner_balance.rml
index 2c62375bf64..2c5387fc246 100644
--- a/addons/account/report/account_aged_partner_balance.rml
+++ b/addons/account/report/account_aged_partner_balance.rml
@@ -40,33 +40,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -104,10 +81,10 @@
-
-
-
-
+
+
+
+
@@ -121,7 +98,7 @@