Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-account-asset-report_asset_analysis-uco into lp:~openerp-dev/openobject-addons/trunk-account-asset.
Requested reviews: OpenERP R&D Team (openerp-dev) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-asset-report_asset_analysis-uco/+merge/63201 [IMP]: account_asset: ---------------------------------- * assets analysis report: -> 'asset analysis' depreciation lines (in reporting. Replace the existing one) * filter on "posted" (move_line_id is True) * group by asset, asset category, date -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-asset-report_asset_analysis-uco/+merge/63201 Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-account-asset-report_asset_analysis-uco into lp:~openerp-dev/openobject-addons/trunk-account-asset.
=== modified file 'account_asset/report/account_asset_report.py' --- account_asset/report/account_asset_report.py 2011-05-09 09:28:55 +0000 +++ account_asset/report/account_asset_report.py 2011-06-02 08:46:06 +0000 @@ -1,3 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). +# +# 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 <http://www.gnu.org/licenses/>. +# +############################################################################## + import tools from osv import fields,osv @@ -6,20 +27,49 @@ _description = "Assets Analysis" _auto = False _columns = { - 'date': fields.date('Asset Date', readonly=True), - 'asset_id': fields.many2one('account.asset.asset',string='Asset'), -# 'asset_category': fields.many2one('account.asset.category',string='Asset category'), - 'state': fields.related('asset_id','state',type='char', string='State', readonly=True), + 'name': fields.char('Year', size=64, required=False, 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), + 'date': fields.date('Depreciation Date', readonly=True), + 'purchase_date': fields.date('Asset Date', required=True), + 'asset_id': fields.many2one('account.asset.asset', string='Asset', readonly=True), + 'asset_category_id': fields.many2one('account.asset.category',string='Asset category'), + 'state': fields.selection([('draft','Draft'),('open','Running'),('close','Close')], 'state', required=True, readonly=True), + 'remaining_value': fields.float('Amount to Depreciate', required=True, readonly=True), + 'depreciated_value': fields.float('Amount Already Depreciated', required=True, readonly=True), + 'depreciation_date': fields.date('Depreciation Date', size=64, readonly=True), + 'move_check': fields.boolean('Posted', readonly=True), + 'nbr':fields.integer('# of Depreciation Lines', readonly=True), } + def init(self, cr): - tools.drop_view_if_exists(cr, 'asset_asset_report') - cr.execute(""" - create or replace view asset_asset_report as ( - select id as id, - asset_id as asset_id, - date as date, - state as state - from - account_move_line )""") + tools.drop_view_if_exists(cr, 'asset_asset_report') + cr.execute(""" + create or replace view asset_asset_report as ( + select + min(dl.id) as id, + to_char(a.purchase_date, 'YYYY') as name, + to_char(a.purchase_date, 'MM') as month, + to_char(a.purchase_date, 'YYYY-MM-DD') as day, + to_date(dl.depreciation_date, 'YYYY-MM-DD') as date, + a.purchase_date as purchase_date, + sum(dl.remaining_value) as remaining_value, + sum(dl.depreciated_value) as depreciated_value, + dl.move_check as move_check, + dl.asset_id as asset_id, + a.category_id as asset_category_id, + a.state as state, + count(dl.*) as nbr + from + account_asset_depreciation_line dl + left join account_asset_asset a on (dl.asset_id=a.id) + group by + dl.asset_id, dl.depreciation_date, dl.move_check, a.state, a.category_id, a.purchase_date + )""") asset_asset_report() === modified file 'account_asset/report/account_asset_report_view.xml' --- account_asset/report/account_asset_report_view.xml 2011-05-09 09:28:55 +0000 +++ account_asset/report/account_asset_report_view.xml 2011-06-02 08:46:06 +0000 @@ -1,60 +1,97 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + <record model="ir.ui.view" id="view_asset_asset_report_tree"> - <field name="name">asset.asset.report.tree</field> - <field name="model">asset.asset.report</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Assets"> - </tree> - </field> - </record> -<!-- <record model="ir.actions.act_window" id="action_account_asset_report_form"> - <field name="name">account.asset.report.graph</field> - <field name="model">account.asset.report</field> - <field name="type">graph</field> - <field name="arch" type="xml"> - <graph string="Assets Analysis" type="bar"> - </graph> - </field> - </record> - --> + <field name="name">asset.asset.report.tree</field> + <field name="model">asset.asset.report</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Assets"> + <field name="name" invisible="1"/> + <field name="asset_id" invisible="1"/> + <field name="asset_category_id" invisible="1"/> + <field name="state" invisible="1"/> + <field name="month" invisible="1"/> + <field name="date" invisible="1"/> + <field name="day" invisible="1"/> + <field name="purchase_date" invisible="1"/> + <field name="date" invisible="1"/> + <field name="move_check" invisible="1"/> + <field name="nbr" sum="# of Depreciation Lines"/> + <field name="remaining_value" sum="# Amount to Depreciate"/> + <field name="depreciated_value" sum="# Amount Already Depreciated"/> + </tree> + </field> + </record> + + <record model="ir.ui.view" id="action_account_asset_report_form"> + <field name="name">asset.asset.report.graph</field> + <field name="model">asset.asset.report</field> + <field name="type">graph</field> + <field name="arch" type="xml"> + <graph string="Assets Analysis" type="bar"> + <field name="asset_id"/> + <field name="remaining_value"/> + </graph> + </field> + </record> + <record id="view_asset_asset_report_search" model="ir.ui.view"> <field name="name">asset.asset.report.search</field> - <field name="model">asset.asset.report</field> - <field name="type">search</field> - <field name="arch" type="xml"> - <search string="Assets Analysis"> - <group col="10" colspan="12"> - <filter string="State" - icon="terp-stock_effects-object-colorize" - domain="[('state','=','draft')]" - help="Draft Assets"/> - </group> - <newline/> - <group expand="1" string="Group By..."> - <filter string="Asset" name="asset_id" context="{'group_by':'asset_id'}"/> - <filter string="Asset Category" name="asset_category"/> - <separator orientation="vertical"/> - <filter string="Asset Date" name="date"/> - </group> + <field name="model">asset.asset.report</field> + <field name="type">search</field> + <field name="arch" type="xml"> + <search string="Assets Analysis"> + <group col="10" colspan="12"> + <filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help="Draft Assets"/> + <filter string="Open" icon="terp-check" domain="[('state','=','open')]" help="Open Assets"/> + <separator orientation="vertical"/> + <filter string="Posted" name="posted" icon="terp-camera_test" domain="[('move_check','=',True)]" help="Posted moves for assets."/> + <separator orientation="vertical"/> + <filter string="Year" icon="terp-go-year" + domain="[('purchase_date','<=', time.strftime('%%Y-%%m-%%d')),('purchase_date','>=',time.strftime('%%Y-01-01'))]" + help="Assets purchased in current year"/> + <filter string="Month" icon="terp-go-month" name="this_month" + domain="[('purchase_date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('purchase_date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" + help="Assets purchased in current month"/> + <filter icon="terp-go-month" string="Month-1" separator="1" + domain="[('purchase_date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('purchase_date','>=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" + help="Assets purchased in last month"/> + <separator orientation="vertical"/> + <field name="asset_id"/> + <field name="asset_category_id"/> + </group> + <newline/> + <group expand="1" string="Group By..."> + <filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/> + <filter string="Asset Category" name="asset_category" icon="terp-stock_symbol-selection" context="{'group_by':'asset_category_id'}"/> + <separator orientation="vertical"/> + <filter string="Asset Date" icon="terp-go-today" context="{'group_by':'purchase_date'}"/> + <separator orientation="vertical" /> + <filter string="Day" icon="terp-go-today" + domain="[]" context="{'group_by':'day'}" help="Day on which assets are purchased."/> + <filter string="Month" icon="terp-go-month" + domain="[]" context="{'group_by':'month'}" help="Month in which assets are purchased."/> + <filter string="Year" icon="terp-go-year" + domain="[]" context="{'group_by':'name'}" help="Year in which assets are purchased."/> + </group> </search> - </field> + </field> </record> - <record model="ir.actions.act_window" id="action_asset_asset_report"> <field name="name">Assets Analysis</field> - <field name="res_model">asset.asset.report</field> - <field name="view_type">form</field> - <field name="view_mode">tree</field> - <field name="search_view_id" ref="view_asset_asset_report_search"/> - <field name="help">From this report, you can have an overview on all depreciation. The tool search can also be used to personalise your Assets reports and so, match this analysis to your needs;</field> + <field name="res_model">asset.asset.report</field> + <field name="view_type">form</field> + <field name="view_mode">tree,graph</field> + <field name="search_view_id" ref="view_asset_asset_report_search"/> + <field name="context">{'search_default_asset_category':1, 'search_default_posted':1, 'group_by':[], 'group_by_no_leaf':1}</field> + <field name="help">From this report, you can have an overview on all depreciation. The tool search can also be used to personalise your Assets reports and so, match this analysis to your needs;</field> </record> + <menuitem action="action_asset_asset_report" - id="menu_action_asset_asset_report" - parent="account.menu_finance_statistic_report_statement" - /> + id="menu_action_asset_asset_report" + parent="account.menu_finance_statistic_report_statement"/> </data> </openerp>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp

