Merged code of Account_report_history to account_report and minor bugfixes
bzr revid: jvo@tinyerp.com-20081008112231-pnmjgn406frkonyh
This commit is contained in:
parent
15581c61f6
commit
80c7b660aa
|
@ -30,7 +30,7 @@
|
|||
import time
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
|
||||
import pooler
|
||||
from tools.misc import currency
|
||||
|
||||
import mx.DateTime
|
||||
|
@ -177,5 +177,34 @@ class account_report(osv.osv):
|
|||
|
||||
account_report()
|
||||
|
||||
class account_report_history(osv.osv):
|
||||
|
||||
def _calc_value(self, cr, uid, ids, name, args, context):
|
||||
acc_report_id=self.read(cr,uid,ids,['tmp','period_id'])
|
||||
tmp_ids={}
|
||||
for a in acc_report_id:
|
||||
period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr,uid,[a['period_id'][0]])[0]
|
||||
period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])])
|
||||
tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr,uid,[a['tmp']],context={'periods':period_id})[0]['amount']
|
||||
return tmp_ids
|
||||
|
||||
_name = "account.report.history"
|
||||
_description = "Indicator"
|
||||
_table = "account_report"
|
||||
_auto = False
|
||||
_order='name'
|
||||
_columns = {
|
||||
'period_id': fields.many2one('account.period','Period', readonly=True, select=True),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear','Fiscal Year', readonly=True, select=True),
|
||||
'name': fields.many2one('account.report.report','Indicator', readonly=True, select=True),
|
||||
'val': fields.function(_calc_value, method=True, string='Value', readonly=True),
|
||||
'tmp' : fields.integer(string='temp',readonly=True)
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute('''create or replace view account_report as (select ar.id as tmp,((pr.id*100000)+ar.id) as id,ar.id as name,pr.id as period_id,pr.fiscalyear_id as fiscalyear_id from account_report_report as ar cross join account_period as pr group by ar.id,pr.id,pr.fiscalyear_id)''')
|
||||
|
||||
account_report_history()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="view_account_report_form" model="ir.ui.view">
|
||||
<field name="name">account.report.report.form</field>
|
||||
<field name="model">account.report.report</field>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<label align="0.0" string="report('REPORT_CODE')"/>
|
||||
<label align="1.0" string="Operators:"/>
|
||||
<label align="0.0" string="+ - * / ( )"/>
|
||||
<label colspan="4" string="Exemple: (balance('6','45') - credit('7')) / report('RPT1')"/>
|
||||
<label colspan="4" string="Example: (balance('6','45') - credit('7')) / report('RPT1')"/>
|
||||
<separator colspan="4" string="Return value for status"/>
|
||||
<group col="2" colspan="1">
|
||||
<label align="1.0" string="< -1:"/>
|
||||
|
@ -55,7 +55,7 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_account_report_tree_simple" model="ir.ui.view">
|
||||
<field name="name">account.report.report.tree.simple</field>
|
||||
<field name="model">account.report.report</field>
|
||||
|
@ -67,7 +67,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_account_report_tree" model="ir.actions.act_window">
|
||||
<field name="name">Custom reporting</field>
|
||||
<field name="res_model">account.report.report</field>
|
||||
|
@ -76,8 +76,9 @@
|
|||
<field name="domain"/>
|
||||
<field name="view_id" ref="view_account_report_tree_simple"/>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="action_account_report_tree" id="menu_action_account_report_tree_define" parent="account.menu_finance_configuration"/>
|
||||
|
||||
<record id="action_account_report_form" model="ir.actions.act_window">
|
||||
<field name="name">New Reporting Item Formula</field>
|
||||
<field name="res_model">account.report.report</field>
|
||||
|
@ -85,7 +86,7 @@
|
|||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem action="action_account_report_form" id="menu_action_account_report_form" parent="account_report.menu_action_account_report_tree_define"/>
|
||||
|
||||
|
||||
<record id="view_account_report_tree" model="ir.ui.view">
|
||||
<field name="name">account.report.report.tree</field>
|
||||
<field name="model">account.report.report</field>
|
||||
|
@ -101,7 +102,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_account_report_tree_view" model="ir.actions.act_window">
|
||||
<field name="name">Custom reporting</field>
|
||||
<field name="res_model">account.fiscalyear</field>
|
||||
|
@ -110,8 +111,8 @@
|
|||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
</record>
|
||||
<menuitem action="action_account_report_tree_view" id="menu_action_account_report_tree_view" parent="account.menu_finance_reporting"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<record id="action_account_report_tree_view_fiscal" model="ir.actions.act_window">
|
||||
<field name="name">Fiscal Statements reporting</field>
|
||||
<field name="res_model">account.fiscalyear</field>
|
||||
|
@ -120,7 +121,7 @@
|
|||
<field name="domain">[('type','=','fiscal'),('parent_id','=',False)]</field>
|
||||
</record>
|
||||
<menuitem action="action_account_report_tree_view_fiscal" id="menu_action_account_report_tree_view_fiscal" parent="account_report.menu_action_account_report_tree_view"/>
|
||||
|
||||
|
||||
<record id="action_account_report_tree_view_indicator" model="ir.actions.act_window">
|
||||
<field name="name">Indicators reporting</field>
|
||||
<field name="res_model">account.fiscalyear</field>
|
||||
|
@ -129,7 +130,7 @@
|
|||
<field name="domain">[('type','=','indicator'),('parent_id','=',False)]</field>
|
||||
</record>
|
||||
<menuitem action="action_account_report_tree_view_indicator" id="menu_action_account_report_tree_view_indicator" parent="account_report.menu_action_account_report_tree_view"/>
|
||||
|
||||
|
||||
<record id="action_account_report_tree_view_other" model="ir.actions.act_window">
|
||||
<field name="name">Others reportings</field>
|
||||
<field name="res_model">account.fiscalyear</field>
|
||||
|
@ -138,7 +139,75 @@
|
|||
<field name="domain">[('type','=','other'),('parent_id','=',False)]</field>
|
||||
</record>
|
||||
<menuitem action="action_account_report_tree_view_other" id="menu_action_account_report_tree_view_other" parent="account_report.menu_action_account_report_tree_view"/>
|
||||
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="account_report_history_tree">
|
||||
<field name="name">account.report.history1</field>
|
||||
<field name="model">account.report.history</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Account Report History">
|
||||
<field name="period_id"/>
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="name"/>
|
||||
<field name="val"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_report_history_form">
|
||||
<field name="name">account.report.history2</field>
|
||||
<field name="model">account.report.history</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account Report History">
|
||||
<field name="period_id" select="2"/>
|
||||
<field name="fiscalyear_id" select="1"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="val"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_report_history_graph">
|
||||
<field name="name">account.report.history3</field>
|
||||
<field name="model">account.report.history</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Account Report History" type="bar">
|
||||
<field name="period_id"/>
|
||||
<field name="val" operator="+"/>
|
||||
<field name="name" group="True"/>
|
||||
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="account_report_history_record">
|
||||
<field name="res_model">account.report.history</field>
|
||||
<field name="name">All Indicators History</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="account_report_history_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_account_report_history_record" action="account_report_history_record" parent="account.menu_finance_reporting"/>
|
||||
|
||||
<act_window
|
||||
id="account_report_history_record_structure"
|
||||
name="Indicator history"
|
||||
res_model="account.report.history"
|
||||
src_model="account.report.report"
|
||||
domain="[('name','=', active_id)]"
|
||||
view_type="form"
|
||||
view_mode="graph,tree"/>
|
||||
|
||||
<record model="ir.values" id="ir_open_account_history_view">
|
||||
<field name="key2">tree_but_open</field>
|
||||
<field name="model">account.report.report</field>
|
||||
<field name="name">Open account history</field>
|
||||
<field name="value" eval="'ir.actions.act_window,%d'%account_report_history_record_structure"/>
|
||||
<field name="object" eval="True"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue