[ADD] account/project/wizard : convert account_analytic_invert_balance_report to osv_memory

bzr revid: psi@tinyerp.co.in-20100428051312-q0wkepu5o4xyy4k2
This commit is contained in:
psi (Open ERP) 2010-04-28 10:43:12 +05:30
parent f9d82dd54b
commit ce63f71019
5 changed files with 80 additions and 31 deletions

View File

@ -94,6 +94,7 @@ module named account_voucherss
'project/wizard/account_analytic_check_view.xml',
'project/wizard/account_analytic_balance_report_view.xml',
'project/wizard/account_analytic_cost_ledger_view.xml',
'project/wizard/account_analytic_inverted_balance_report.xml',
'product_view.xml',
'account_assert_test.xml',
'process/statement_process.xml',
@ -118,4 +119,4 @@ module named account_voucherss
'active': False,
'certificate': '0080331923549',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -13,7 +13,7 @@
<report auto="False" id="account_analytic_account_inverted_balance" menu="False" model="account.analytic.account" name="account.analytic.account.inverted.balance" rml="account/project/report/inverted_analytic_balance.rml" string="Inverted Analytic Balance"/>
<wizard id="account_analytic_account_inverted_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.inverted.balance.report" string="Inverted Analytic Balance"/>
<!-- <wizard id="account_analytic_account_inverted_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.inverted.balance.report" string="Inverted Analytic Balance"/>-->
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>

View File

@ -21,12 +21,11 @@
import wizard_account_analytic_journal_report
import account_analytic_balance_report
import wizard_account_analytic_inverted_balance_report
import account_analytic_inverted_balance_report
import account_analytic_cost_ledger_report
import wizard_account_analytic_cost_ledger_for_journal_report
import account_analytic_check
import project_account_analytic_line
import wizard_analytic_account_chart
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,38 +15,42 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Select period">
<field name="date1"/>
<field name="date2"/>
</form>'''
from osv import osv, fields
dates_fields = {
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}
class account_analytic_inverted_balance(osv.osv_memory):
_name = 'account.analytic.inverted.balance'
_description = 'Account Analytic Inverted Balance'
class wizard_report(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'), ('report','Print')]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'account.analytic.account.inverted.balance', 'state':'end'}
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
}
}
wizard_report('account.analytic.account.inverted.balance.report')
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
datas = {
'ids': context.get('active_ids',[]),
'model': 'account.analytic.account',
'form': data
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.analytic.account.inverted.balance',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
account_analytic_inverted_balance()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_analytic_invert_balance_view" model="ir.ui.view">
<field name="name">Account Analytic Inverted Balance</field>
<field name="model">account.analytic.inverted.balance</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Period">
<group colspan="4" col="6">
<field name="date1"/>
<field name="date2"/>
</group>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_analytic_invert_balance" model="ir.actions.act_window">
<field name="name">Inverted Analytic Balance</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.inverted.balance</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_analytic_invert_balance_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_analytic_invert_balance_values">
<field name="model_id" ref="analytic.model_account_analytic_account" />
<field name="object" eval="1" />
<field name="name">Account Analytic Inverted Balance</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_invert_balance'))" />
<field name="key">action</field>
<field name="model">account.analytic.account</field>
</record>
</data>
</openerp>