[IMP] account_asset: Improved report, view and license.

bzr revid: uco@tinyerp.com-20110606100629-5wvorazdo9nad9eb
This commit is contained in:
Ujjvala Collins (OpenERP) 2011-06-06 15:36:29 +05:30
parent 5f8af38fad
commit 0a44a58368
4 changed files with 33 additions and 26 deletions

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2004-2010 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

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2004-2010 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

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2004-2010 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
@ -27,49 +27,53 @@ class asset_asset_report(osv.osv):
_description = "Assets Analysis"
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'name': fields.char('Year', size=16, 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),
'day': fields.char('Day', size=16, 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'),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'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),
'nbr': fields.integer('# of Depreciation Lines', readonly=True),
'company_id': fields.many2one('res.company', 'Company', 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
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.amount as remaining_value,
dl.move_check as move_check,
dl.asset_id as asset_id,
a.category_id as asset_category_id,
a.partner_id as partner_id,
a.state as state,
count(dl.*) as nbr
count(dl.*) as nbr,
a.company_id as company_id
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
dl.asset_id, dl.move_check, a.state,
a.category_id, a.partner_id, a.purchase_date, dl.amount,
a.company_id, a.purchase_value, a.salvage_value
)""")
asset_asset_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -13,19 +13,16 @@
<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">
<record model="ir.ui.view" id="action_account_asset_report_graph">
<field name="name">asset.asset.report.graph</field>
<field name="model">asset.asset.report</field>
<field name="type">graph</field>
@ -47,7 +44,7 @@
<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."/>
<filter string="Posted" name="posted" icon="terp-camera_test" domain="[('move_check','=',True)]" help="Posted depreciation lines for assets."/>
<separator orientation="vertical"/>
<filter string="Year" icon="terp-go-year"
domain="[('purchase_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('purchase_date','&gt;=',time.strftime('%%Y-01-01'))]"
@ -62,6 +59,12 @@
<field name="asset_id"/>
<field name="asset_category_id"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<field name="purchase_date" string="Asset Purchase Date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/>
@ -81,13 +84,13 @@
</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,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>
<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,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, 'search_default_purchase_date': time.strftime('%Y-01-01'), '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"