[ADD] account_invoice_layout : convert account_invoice_special_message wizard to osv_memory

bzr revid: psi@tinyerp.co.in-20100428123919-62388idf9p71pz7a
This commit is contained in:
psi (Open ERP) 2010-04-28 18:09:19 +05:30
parent 6ae7b8b26a
commit ff1e0be0e1
5 changed files with 79 additions and 38 deletions

View 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,

View 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"

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,10 +15,10 @@
# 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:

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,34 @@
# 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/>.
#
##############################################################################
from osv import osv, fields
import wizard
import time
import datetime
import pooler
class account_invoice_special_msg(osv.osv_memory):
_name = 'account.invoice.special.msg'
_description = 'Account Invoice Special Message'
invoice_form = """<?xml version="1.0"?>
<form string="Select Message">
<field name="message"/>
</form>"""
_columns = {
'message': fields.many2one('notify.message', 'Message', required = True, help="Message to Print at the bottom of report"),
}
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:
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:

View File

@ -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>