[ADD] account_invoice_layout : convert account_invoice_special_message wizard to...
authorpsi (Open ERP) <psi@tinyerp.co.in>
Wed, 28 Apr 2010 12:39:19 +0000 (18:09 +0530)
committerpsi (Open ERP) <psi@tinyerp.co.in>
Wed, 28 Apr 2010 12:39:19 +0000 (18:09 +0530)
bzr revid: psi@tinyerp.co.in-20100428123919-62388idf9p71pz7a

addons/account_invoice_layout/__openerp__.py
addons/account_invoice_layout/account_invoice_layout_report.xml
addons/account_invoice_layout/wizard/__init__.py
addons/account_invoice_layout/wizard/account_invoice_special_message.py [new file with mode: 0644]
addons/account_invoice_layout/wizard/account_invoice_special_message.xml [new file with mode: 0644]
addons/account_invoice_layout/wizard/invoice_special_message.py [deleted file]

index 5ba6a92..f2df124 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,7 +15,7 @@
 #    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/>.
 #
 ##############################################################################
 
@@ -42,7 +42,8 @@
     'update_xml': [
         'security/ir.model.access.csv',
         'account_invoice_layout_view.xml',
-        'account_invoice_layout_report.xml'
+        'account_invoice_layout_report.xml',
+        'wizard/account_invoice_special_message.xml',
     ],
     'demo_xml': [],
     'installable': True,
index 2579609..747bc83 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
 <openerp>
        <data>
-       <wizard string="Invoices with Layout and Message"
+<!--   <wizard string="Invoices with Layout and Message"
                        model="account.invoice"
                        name="wizard.notify_message"
                        id="wizard_notify_message"
                        keyword="client_print_multi"
-                       />
+                       /> -->
 
        <report id="account_invoices_1"
                        string="Invoices with Layout"
index 62b012d..3b724ad 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
 #    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 invoice_special_message
+import account_invoice_special_message
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
diff --git a/addons/account_invoice_layout/wizard/account_invoice_special_message.py b/addons/account_invoice_layout/wizard/account_invoice_special_message.py
new file mode 100644 (file)
index 0000000..5936e4c
--- /dev/null
@@ -0,0 +1,48 @@
+# -*- 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_invoice_special_msg(osv.osv_memory):
+    _name = 'account.invoice.special.msg'
+    _description = 'Account Invoice Special Message'
+
+    _columns = {
+        'message': fields.many2one('notify.message', 'Message', required = True, help="Message to Print at the bottom of report"),
+        }
+
+    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.invoice',
+             'form': data
+                 }
+        return {
+            'type': 'ir.actions.report.xml',
+            'report_name': 'notify_account.invoice',
+            'datas': datas,
+            }
+
+account_invoice_special_msg()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_invoice_layout/wizard/account_invoice_special_message.xml b/addons/account_invoice_layout/wizard/account_invoice_special_message.xml
new file mode 100644 (file)
index 0000000..b1cf735
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+               <record id="account_invoice_special_msg_view" model="ir.ui.view">
+                       <field name="name">Account Invioce Special Message</field>
+                       <field name="model">account.invoice.special.msg</field>
+                       <field name="type">form</field>
+                       <field name="arch" type="xml">
+                               <form string="Select Message">
+                                       <group colspan="4" col="6">
+                                               <field name="message"/>
+                                       </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_invoice_special_msg" model="ir.actions.act_window">
+                       <field name="name">Invoices with Layout and Message</field>
+                       <field name="type">ir.actions.act_window</field>
+                       <field name="res_model">account.invoice.special.msg</field>
+                       <field name="view_type">form</field>
+                       <field name="view_mode">form</field>
+                       <field name="view_id" ref="account_invoice_special_msg_view"/>
+                       <field name="target">new</field>
+               </record>
+
+               <record model="ir.values" id="account_invoice_special_msg_values">
+                       <field name="model_id" ref="account.model_account_invoice" />
+                       <field name="object" eval="1" />
+                       <field name="name">Account Invioce Special Message</field>
+                       <field name="key2">client_print_multi</field>
+                       <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_invoice_special_msg'))" />
+                       <field name="key">action</field>
+                       <field name="model">account.invoice</field>
+               </record>
+
+    </data>
+</openerp>
\ No newline at end of file
diff --git a/addons/account_invoice_layout/wizard/invoice_special_message.py b/addons/account_invoice_layout/wizard/invoice_special_message.py
deleted file mode 100644 (file)
index a97b3a1..0000000
+++ /dev/null
@@ -1,52 +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 time
-import datetime
-import pooler
-
-invoice_form = """<?xml version="1.0"?>
-<form string="Select Message">
-    <field name="message"/>
-</form>"""
-
-invoice_fields = {
-    'message': {'string': 'Message', 'type': 'many2one', 'relation': 'notify.message', 'required': True},
-   }
-
-class wizard_report(wizard.interface):
-
-    states = {
-        'init': {
-            'actions': [],
-            'result': {'type':'form', 'arch':invoice_form, 'fields':invoice_fields, 'state':[('end','Cancel'),('print','Print')]},
-        },
-        'print': {
-            'actions': [],
-            'result': {'type':'print', 'report':'notify_account.invoice', 'state':'end'},
-        },
-    }
-
-wizard_report('wizard.notify_message')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-