diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 04f55566d40..fe3f93b492c 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -113,8 +113,6 @@ module named account_vouchers 'report/account_invoice_report_view.xml', 'report/account_entries_report_view.xml', 'report/account_report_view.xml', - 'report/account_analytic_report_view.xml', - 'report/account_account_report_view.xml', 'report/account_analytic_entries_report_view.xml', 'board_account_view.xml', "wizard/account_pl_report_view.xml", diff --git a/addons/account/report/account_account_report_view.xml b/addons/account/report/account_account_report_view.xml deleted file mode 100644 index bd9101a3382..00000000000 --- a/addons/account/report/account_account_report_view.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - account.account.report.tree - account.account.report - tree - - - - - - - - - - - - - - - - - - - - - account.account.report.graph - account.account.report - graph - - - - - - - - - - - - account.account.report.search - account.account.report - search - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Accounts Analysis - account.account.report - form - tree,graph - {"search_default_Account":1,"search_default_At Date":1,'group_by_no_leaf':1,'group_by':[]} - - - - - - - diff --git a/addons/account/report/account_analytic_report.py b/addons/account/report/account_analytic_report.py deleted file mode 100644 index a740076ad09..00000000000 --- a/addons/account/report/account_analytic_report.py +++ /dev/null @@ -1,94 +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 tools -from osv import fields,osv - -class analytic_report(osv.osv): - _name = "analytic.report" - _description = "Analytic Accounts Statistics" - _auto = False - _columns = { - 'date_start': fields.date('Date Start', readonly=True), - 'date_end': fields.date('Date End', readonly=True), - 'name' : fields.char('Analytic Account', size=128, readonly=True), - 'partner_id' : fields.many2one('res.partner', 'Associated Partner', readonly=True), - 'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', readonly=True), - 'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', readonly=True), - 'user_id' : fields.many2one('res.users', 'Account Manager', readonly=True), - 'product_id' : fields.many2one('product.product', 'Product', readonly=True), - 'total_quantity': fields.float('# Total Quantity', readonly=True), - 'debit' : fields.float('Debit', readonly=True), - 'credit' : fields.float('Credit', readonly=True), - 'balance' : fields.float('Balance', readonly=True), - 'year': fields.char('Year', size=4, readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), - ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True), - 'day': fields.char('Day', size=128, readonly=True), - 'nbr':fields.integer('# of Lines', readonly=True), - 'company_id': fields.many2one('res.company', 'Company', readonly=True), - 'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type'), - - 'state': fields.selection([('draft','Draft'), - ('open','Open'), - ('pending','Pending'), - ('cancelled', 'Cancelled'), - ('close','Close'), - ('template', 'Template')], - 'State', readonly=True), - - } - _order = 'date_start desc' - def init(self, cr): - tools.drop_view_if_exists(cr, 'analytic_report') - cr.execute(""" - create or replace view analytic_report as ( - select - min(s.id) as id, - to_char(s.create_date, 'YYYY') as year, - to_char(s.create_date, 'MM') as month, - to_char(s.create_date, 'YYYY-MM-DD') as day, - l.journal_id, - l.product_id, - s.parent_id, - s.date_start, - s.date as date_end, - s.user_id, - s.company_id, - s.type, - s.name, - s.partner_id, - sum(s.quantity) as total_quantity, - s.debit, - s.credit, - s.balance, - count(*) as nbr, - s.state - from account_analytic_account s - left join account_analytic_line l on (s.id=l.account_id) - GROUP BY s.create_date,s.state,l.journal_id,s.name, - s.partner_id,s.date_start,s.date,s.user_id, - s.company_id,s.type, - s.debit,s.credit,s.balance,s.parent_id,l.product_id - ) - """) -analytic_report() diff --git a/addons/account/report/account_analytic_report_view.xml b/addons/account/report/account_analytic_report_view.xml index 070b3a8c10a..b3570a73da0 100644 --- a/addons/account/report/account_analytic_report_view.xml +++ b/addons/account/report/account_analytic_report_view.xml @@ -1,128 +1,6 @@ - - analytic.report.tree - analytic.report - tree - - - - - - - - - - - - - - - - - - - - - - - - - - analytic.report.search - analytic.report - search - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - account.analytic.report.graph - analytic.report - graph - - - - - - - - - - - - Analytic Accounts Analysis - analytic.report - form - tree,graph - {'search_default_This Month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]} - - - diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index 2c22db01e53..f8ae020bae0 100644 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -24,45 +24,48 @@ from osv import fields,osv class account_entries_report(osv.osv): _name = "account.entries.report" - _description = "Entries" + _description = "Journal Items Analysis" _auto = False _rec_name = 'date' _columns = { 'date': fields.date('Effective Date', readonly=True), 'date_created': fields.date('Date Created', readonly=True), 'date_maturity': fields.date('Date Maturity', readonly=True), - 'nbr':fields.integer('# of Entries', readonly=True), - 'nbl':fields.integer('# of Lines', readonly=True), - 'amount': fields.float('Amount', readonly=True), + 'ref': fields.char('Reference', size=64, readonly=True), + + 'nbr':fields.integer('# of Items', readonly=True), + 'debit':fields.float('Debit', readonly=True), + 'credit':fields.float('Credit', readonly=True), + 'balance': fields.float('Balance', readonly=True), 'year': fields.char('Year', size=4, readonly=True), - 'day': fields.char('Day', size=128, readonly=True), + 'date': fields.date('Date', size=128, readonly=True), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True), - 'ref': fields.char('Reference', size=64, readonly=True), 'period_id': fields.many2one('account.period', 'Period', readonly=True), 'account_id': fields.many2one('account.account', 'Account', readonly=True), 'journal_id': fields.many2one('account.journal', 'Journal', readonly=True), + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', readonly=True), 'product_id': fields.many2one('product.product', 'Product', readonly=True), 'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State', readonly=True, help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'), 'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True, help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'), 'partner_id': fields.many2one('res.partner','Partner', readonly=True), - 'period_id2': fields.many2one('account.period', 'Move Line Period', readonly=True), 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), - 'journal_id2': fields.many2one('account.journal', 'Move Line Journal', readonly=True), - 'type': fields.selection([ - ('pay_voucher','Cash Payment'), - ('bank_pay_voucher','Bank Payment'), - ('rec_voucher','Cash Receipt'), - ('bank_rec_voucher','Bank Receipt'), - ('cont_voucher','Contra'), - ('journal_sale_vou','Journal Sale'), - ('journal_pur_voucher','Journal Purchase'), - ('journal_voucher','Journal Voucher'), - ],'Type',readonly=True), 'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True), + 'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True), + 'type': fields.selection([ + ('receivable', 'Receivable'), + ('payable', 'Payable'), + ('view', 'View'), + ('consolidation', 'Consolidation'), + ('other', 'Others'), + ('closed', 'Closed'), + ], 'Internal Type', readonly=True, help="This type is used to differentiate types with "\ + "special effects in Open ERP: view can not have entries, consolidation are accounts that "\ + "can have children accounts for multi-company consolidations, payable/receivable are for "\ + "partners accounts (for debit/credit computations), closed for depreciated accounts."), 'company_id': fields.many2one('res.company', 'Company', readonly=True), } _order = 'date desc' @@ -71,52 +74,36 @@ class account_entries_report(osv.osv): tools.drop_view_if_exists(cr, 'account_entries_report') cr.execute(""" create or replace view account_entries_report as ( - select - min(l.id) as id, - am.ref as ref, - sum(l.quantity) as quantity, - am.state as state, - l.state as state_2, - am.date as date, - count(l.id) as nbr, - count(distinct am.id) as nbl, - l.debit as amount, - to_char(am.date, 'YYYY') as year, - to_char(am.date, 'MM') as month, - to_char(am.date, 'YYYY-MM-DD') as day, - am.company_id as company_id, - l.account_id as account_id, - l.analytic_account_id as analytic_account_id, - l.date_created as date_created, - l.date_maturity as date_maturity, - am.journal_id as journal_id, - l.journal_id as journal_id2, - l.period_id as period_id2, - am.period_id as period_id, - l.partner_id as partner_id, - l.product_id as product_id, - am.type as type - from - account_move_line l - left join - account_move am on (am.id=l.move_id) - group by am.ref, - am.state, - am.date, - am.company_id, - am.journal_id, - l.journal_id, - am.period_id, - l.period_id, - am.type, - l.partner_id, - l.analytic_account_id, - l.product_id, - l.date_created, - l.date_maturity, - l.account_id, - l.state, - l.debit + select + l.id as id, + am.date as date, + l.date_maturity as date_maturity, + l.date_created as date_created, + am.ref as ref, + am.state as state, + l.state as state_2, + to_char(am.date, 'YYYY') as year, + to_char(am.date, 'MM') as month, + l.partner_id as partner_id, + l.product_id as product_id, + am.company_id as company_id, + am.journal_id as journal_id, + p.fiscalyear_id as fiscalyear_id, + am.period_id as period_id, + l.account_id as account_id, + l.analytic_account_id as analytic_account_id, + a.type as type, + a.user_type as user_type, + 1 as nbr, + l.quantity as quantity, + l.debit as debit, + l.credit as credit, + l.debit-l.credit as balance + from + account_move_line l + left join account_account a on (l.account_id = a.id) + left join account_move am on (am.id=l.move_id) + left join account_period p on (am.period_id=p.id) ) """) diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 5645c34d20c..0c000b9d95f 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -14,7 +14,6 @@ - @@ -23,12 +22,13 @@ - + - - - + + + + @@ -38,8 +38,8 @@ graph - - + + @@ -49,77 +49,65 @@ search - - - - - + + + + + icon="terp-document-new" + domain="[('state','=','draft')]" + help = "Draft entries"/> - - - + + + - + + + + + + + - - + + - - - - - - - + - - - - - - - + - - Entries Analysis + Accounting Analysis account.entries.report form tree,graph - {'search_default_This Month':1,'search_default_Journal':1,'group_by_no_leaf':1,'group_by':[]} - + 'search_default_group_journal':1,'search_default_group_period': 1, 'group_by_no_leaf':1,'group_by':[]}