From cd7181d76f7e627bc0ae262b4a206b8f8801f2ae Mon Sep 17 00:00:00 2001 From: "Rajesh Prajapati (OpenERP)" Date: Fri, 23 Nov 2012 15:19:18 +0530 Subject: [PATCH] [IMP] account_check_writing : improvements on account_check_writing as per requirement bzr revid: rpr@tinyerp.com-20121123094918-wrj9sli48tp95n1p --- addons/account_check_writing/__openerp__.py | 2 + .../account_check_sequence.xml | 15 +++++ .../account_check_writing/wizard/__init__.py | 24 ++++++++ .../wizard/account_check.py | 61 +++++++++++++++++++ .../wizard/account_check_view.xml | 28 +++++++++ 5 files changed, 130 insertions(+) create mode 100644 addons/account_check_writing/account_check_sequence.xml create mode 100644 addons/account_check_writing/wizard/__init__.py create mode 100644 addons/account_check_writing/wizard/account_check.py create mode 100644 addons/account_check_writing/wizard/account_check_view.xml diff --git a/addons/account_check_writing/__openerp__.py b/addons/account_check_writing/__openerp__.py index f5a2355b002..292215044fb 100644 --- a/addons/account_check_writing/__openerp__.py +++ b/addons/account_check_writing/__openerp__.py @@ -30,10 +30,12 @@ Module for the Check Writing and Check Printing. 'website': 'http://www.openerp.com', 'depends' : ['account_voucher'], 'data': [ + 'wizard/account_check_view.xml', 'account_check_writing_report.xml', 'account_view.xml', 'account_voucher_view.xml', 'account_check_writing_data.xml', + 'account_check_sequence.xml' ], 'demo': ['account_demo.xml'], 'test': [], diff --git a/addons/account_check_writing/account_check_sequence.xml b/addons/account_check_writing/account_check_sequence.xml new file mode 100644 index 00000000000..def380bbe8a --- /dev/null +++ b/addons/account_check_writing/account_check_sequence.xml @@ -0,0 +1,15 @@ + + + + + Number + account.check.write + + + + Number + account.check.write + + + + diff --git a/addons/account_check_writing/wizard/__init__.py b/addons/account_check_writing/wizard/__init__.py new file mode 100644 index 00000000000..74c20e11397 --- /dev/null +++ b/addons/account_check_writing/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +import account_check + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/wizard/account_check.py b/addons/account_check_writing/wizard/account_check.py new file mode 100644 index 00000000000..123febf2cfc --- /dev/null +++ b/addons/account_check_writing/wizard/account_check.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +import datetime +import time +import tools +from osv import fields, osv +from tools.translate import _ + +class account_check_write(osv.osv_memory): + _name = 'account.check.write' + _description = 'Take input as sequence and print report' + _columns = { + 'check_number': fields.char('Check Number', required=True, help="This is the Check Number"), + } + + _defaults = { + 'check_number': lambda obj, cr, uid, context:obj.pool.get('ir.sequence').get(cr, uid, 'account.check.write'), + } + def print_check_write(self, cr, uid, ids, context=None): + if not ids: + return {} + + check_layout_report = { + 'top' : 'account.print.check.top', + 'middle' : 'account.print.check.middle', + 'bottom' : 'account.print.check.bottom', + } + check_layout = self.pool.get('account.voucher').browse(cr, uid, context['active_ids'], context=context)[0].company_id.check_layout + return { + 'type': 'ir.actions.report.xml', + 'report_name':check_layout_report[check_layout], + 'datas': { + 'model':'account.voucher', + 'id': context['active_ids'] and context['active_ids'][0] or False, + 'ids': context['active_ids'] and context['active_ids'] or [], + 'report_type': 'pdf' + }, + 'nodestroy': True + } + +account_check_write() + diff --git a/addons/account_check_writing/wizard/account_check_view.xml b/addons/account_check_writing/wizard/account_check_view.xml new file mode 100644 index 00000000000..a3930540e43 --- /dev/null +++ b/addons/account_check_writing/wizard/account_check_view.xml @@ -0,0 +1,28 @@ + + + + + + account.check.form + account.check.write + +
+ + + +
+
+
+
+
+ + + +
+