[ADD] account/project/wizard : convert account_analytic_journal_report wizard to...
authorpsi (Open ERP) <psi@tinyerp.co.in>
Wed, 28 Apr 2010 05:41:33 +0000 (11:11 +0530)
committerpsi (Open ERP) <psi@tinyerp.co.in>
Wed, 28 Apr 2010 05:41:33 +0000 (11:11 +0530)
bzr revid: psi@tinyerp.co.in-20100428054133-03y66arqfekz3fuv

addons/account/__openerp__.py
addons/account/project/project_report.xml
addons/account/project/wizard/__init__.py
addons/account/project/wizard/account_analytic_journal_report.py [new file with mode: 0644]
addons/account/project/wizard/account_analytic_journal_report_view.xml [new file with mode: 0644]
addons/account/project/wizard/wizard_account_analytic_journal_report.py [deleted file]

index cd8a673..02ab006 100644 (file)
@@ -95,6 +95,7 @@ module named account_voucherss
         'project/wizard/account_analytic_balance_report_view.xml',
         'project/wizard/account_analytic_cost_ledger_view.xml',
         'project/wizard/account_analytic_inverted_balance_report.xml',
+        'project/wizard/account_analytic_journal_report_view.xml',
         'product_view.xml',
         'account_assert_test.xml',
         'process/statement_process.xml',
index ff2cef7..1b9ae11 100644 (file)
@@ -3,7 +3,7 @@
     <data>
         <report auto="False" id="analytic_journal_print" menu="False" model="account.analytic.journal" name="account.analytic.account.journal" rml="account/project/report/analytic_journal.rml" string="Analytic Journal"/>
 
-        <wizard id="account_analytic_account_journal_report" keyword="client_print_multi" model="account.analytic.journal" name="account.analytic.account.journal.report" string="Analytic Journal"/>
+<!--        <wizard id="account_analytic_account_journal_report" keyword="client_print_multi" model="account.analytic.journal" name="account.analytic.account.journal.report" string="Analytic Journal"/>-->
 
 
         <report auto="False" id="account_analytic_account_balance" menu="False" model="account.analytic.account" name="account.analytic.account.balance" rml="account/project/report/analytic_balance.rml" string="Analytic Balance"/>
index 4788302..50267e8 100644 (file)
@@ -19,7 +19,7 @@
 #
 ##############################################################################
 
-import wizard_account_analytic_journal_report
+import account_analytic_journal_report
 import account_analytic_balance_report
 import account_analytic_inverted_balance_report
 import account_analytic_cost_ledger_report
diff --git a/addons/account/project/wizard/account_analytic_journal_report.py b/addons/account/project/wizard/account_analytic_journal_report.py
new file mode 100644 (file)
index 0000000..aef6a85
--- /dev/null
@@ -0,0 +1,56 @@
+# -*- 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 time
+
+from osv import osv, fields
+
+class account_analytic_Journal_report(osv.osv_memory):
+    _name = 'account.analytic.Journal.report'
+    _description = 'Account Analytic Journal'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+        }
+
+    _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.journal',
+             'form': data
+                 }
+        return {
+            'type': 'ir.actions.report.xml',
+            'report_name': 'account.analytic.journal',
+            'datas': datas,
+            }
+
+account_analytic_Journal_report()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/project/wizard/account_analytic_journal_report_view.xml b/addons/account/project/wizard/account_analytic_journal_report_view.xml
new file mode 100644 (file)
index 0000000..137920e
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+               <record id="account_analytic_journal_view" model="ir.ui.view">
+                       <field name="name">Account Analytic Journal</field>
+                       <field name="model">account.analytic.Journal.report</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_journal" model="ir.actions.act_window">
+                       <field name="name">Analytic Journal</field>
+                       <field name="type">ir.actions.act_window</field>
+                       <field name="res_model">account.analytic.Journal.report</field>
+                       <field name="view_type">form</field>
+                       <field name="view_mode">form</field>
+                       <field name="view_id" ref="account_analytic_journal_view"/>
+                       <field name="target">new</field>
+               </record>
+
+               <record model="ir.values" id="account_analytic_journal_values">
+                       <field name="model_id" ref="account.model_account_analytic_journal" />
+                       <field name="object" eval="1" />
+                       <field name="name">Account Analytic Journal</field>
+                       <field name="key2">client_print_multi</field>
+                       <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_journal'))" />
+                       <field name="key">action</field>
+                       <field name="model">account.analytic.journal</field>
+               </record>
+
+    </data>
+</openerp>
\ No newline at end of file
diff --git a/addons/account/project/wizard/wizard_account_analytic_journal_report.py b/addons/account/project/wizard/wizard_account_analytic_journal_report.py
deleted file mode 100644 (file)
index 03be104..0000000
+++ /dev/null
@@ -1,51 +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 time
-import wizard
-
-dates_form = '''<?xml version="1.0"?>
-<form string="Analytic Journal Report">
-    <field name="date1"/>
-    <field name="date2"/>
-</form>'''
-
-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 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.journal', 'state':'end'}
-        }
-    }
-wizard_report('account.analytic.account.journal.report')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-