[ADD] account/project/wizard : convert account_analytic_chart wizard to osv_memory
bzr revid: psi@tinyerp.co.in-20100428104132-gcb4gyg42jvgg4q5
This commit is contained in:
parent
86fad4e96d
commit
a072f5c462
|
@ -97,6 +97,7 @@ module named account_voucherss
|
|||
'project/wizard/account_analytic_inverted_balance_report.xml',
|
||||
'project/wizard/account_analytic_journal_report_view.xml',
|
||||
'project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml',
|
||||
'project/wizard/account_analytic_chart_view.xml',
|
||||
'product_view.xml',
|
||||
'account_assert_test.xml',
|
||||
'process/statement_process.xml',
|
||||
|
|
|
@ -127,8 +127,8 @@
|
|||
parent="account_analytic_def_account"/>
|
||||
<!-- <menuitem action="action_account_analytic_account_tree2" id="account_analytic_chart" parent="account.menu_finance_charts"/>-->
|
||||
|
||||
<wizard id="wizard_analytic_account_chart" menu="False" model="account.analytic.account" name="account.analytic.account.chart" string="Analytic Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_analytic_account_chart" id="menu_action_analytic_account_tree2" parent="account.menu_finance_charts" type="wizard"/>
|
||||
<!-- <wizard id="wizard_analytic_account_chart" menu="False" model="account.analytic.account" name="account.analytic.account.chart" string="Analytic Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_analytic_account_chart" id="menu_action_analytic_account_tree2" parent="account.menu_finance_charts" type="wizard"/>-->
|
||||
|
||||
<menuitem id="next_id_40" name="Analytic" parent="account.menu_finance_generic_reporting" sequence="4"/>
|
||||
<menuitem action="action_account_analytic_account_tree2" id="account_analytic_chart_balance" parent="next_id_40"/>
|
||||
|
|
|
@ -26,6 +26,6 @@ import account_analytic_cost_ledger_report
|
|||
import account_analytic_cost_ledger_for_journal_report
|
||||
import account_analytic_check
|
||||
import project_account_analytic_line
|
||||
import wizard_analytic_account_chart
|
||||
import account_analytic_chart
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,50 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# 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
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import osv, fields
|
||||
|
||||
class account_analytic_chart(osv.osv_memory):
|
||||
_name = 'account.analytic.chart'
|
||||
_description = 'Account Analytic Chart'
|
||||
|
||||
_columns = {
|
||||
'from_date': fields.date('From'),
|
||||
'to_date': fields.date('To'),
|
||||
}
|
||||
|
||||
def analytic_account_chart_open_window(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
result_context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
if data['from_date']:
|
||||
result_context.update({'from_date' : data['from_date']})
|
||||
if data['to_date']:
|
||||
result_context.update({'to_date' : data['to_date']})
|
||||
result['context'] = str(result_context)
|
||||
return result
|
||||
|
||||
account_analytic_chart()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_analytic_chart_view" model="ir.ui.view">
|
||||
<field name="name">Account Analytic Chart</field>
|
||||
<field name="model">account.analytic.chart</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Analytic Account Charts">
|
||||
<separator string="Select the Period for Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="analytic_account_chart_open_window" string="Open Charts" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_analytic_chart" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Chart of Accounts</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.chart</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_analytic_chart_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Analytic Chart of Accounts"
|
||||
parent="account.menu_finance_charts"
|
||||
action="action_account_analytic_chart"
|
||||
id="menu_action_analytic_account_tree2"
|
||||
icon="STOCK_INDENT"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,78 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# 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
|
||||
# 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 wizard
|
||||
import pooler
|
||||
|
||||
class wizard_analytic_account_chart(wizard.interface):
|
||||
_account_chart_arch = '''<?xml version="1.0"?>
|
||||
<form string="Analytic Account Charts">
|
||||
<separator string="Select the Period for Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
_account_chart_fields = {
|
||||
'from_date': {
|
||||
'string': 'From',
|
||||
'type': 'date',
|
||||
},
|
||||
'to_date': {
|
||||
'string': 'To',
|
||||
'type': 'date',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _analytic_account_chart_open_window(self, cr, uid, data, context):
|
||||
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
|
||||
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
|
||||
result_context = {}
|
||||
if data['form']['from_date']:
|
||||
result_context.update({'from_date' : data['form']['from_date']})
|
||||
if data['form']['to_date']:
|
||||
result_context.update({'to_date' : data['form']['to_date']})
|
||||
|
||||
result['context'] = str(result_context)
|
||||
return result
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':_account_chart_arch, 'fields':_account_chart_fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('open', 'Open Charts', 'gtk-ok')]}
|
||||
},
|
||||
'open': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action':_analytic_account_chart_open_window, 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_analytic_account_chart('account.analytic.account.chart')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue