diff --git a/addons/account_greek_fiscal/__terp__.py b/addons/account_greek_fiscal/__terp__.py index 2330fb7427e..5477851736f 100644 --- a/addons/account_greek_fiscal/__terp__.py +++ b/addons/account_greek_fiscal/__terp__.py @@ -30,7 +30,7 @@ """, "website" : "http://www.hellug.gr", "category" : "Generic Modules/Accounting", - "init_xml" : [ + "init_xml" : [ "account_invoice_data.xml", ], "demo_xml" : [ ], diff --git a/addons/account_greek_fiscal/account_invoice_data.xml b/addons/account_greek_fiscal/account_invoice_data.xml new file mode 100644 index 00000000000..be961e0a089 --- /dev/null +++ b/addons/account_greek_fiscal/account_invoice_data.xml @@ -0,0 +1,11 @@ + + + + + + property_fiscalgr_invoice_report + + + + + diff --git a/addons/account_greek_fiscal/account_invoice_print.py b/addons/account_greek_fiscal/account_invoice_print.py index 69127929745..b1041ee84aa 100644 --- a/addons/account_greek_fiscal/account_invoice_print.py +++ b/addons/account_greek_fiscal/account_invoice_print.py @@ -37,6 +37,9 @@ class account_invoice(osv.osv): ('cancel','Canceled'), ('printed','Printed'), ],'State', select=True, readonly=True), + 'property_fiscalgr_invoice_report': fields.property( 'ir.actions.report.xml', type='many2one', + relation='ir.actions.report.xml', string="Fiscal report template", method=True, + view_load=True, group_name="Reports"), } def copy(self, cr, uid, id, default=None, context=None): if default is None: @@ -56,7 +59,8 @@ class account_invoice(osv.osv): def action_fiscalgr_print(self, cr, uid, ids, *args): fiscalgr_obj = self.pool.get('account.fiscalgr.print') logger = netsvc.Logger() - invoices = self.read(cr, uid, ids, ['id','number','state','type','fiscalgr_print']) + invoices = self.read(cr, uid, ids, ['id','number','state','type', + 'fiscalgr_print','property_fiscalgr_invoice_report']) # First, iterate once to check if the invoices are valid for printing. for i in invoices: if not i['number']: @@ -65,13 +69,15 @@ class account_invoice(osv.osv): raise osv.except_osv(_('Cannot print!'), _('Cannot print invoice \"%s\" which is not open.')%i['number']) if (not i['type'] or (i['type'][0:3] != 'out')): raise osv.except_osv(_('Cannot print!'), _('Cannot print invoice \"%s\", it is not an outgoing one.')%i['number']) + if not i['property_fiscalgr_invoice_report']: + raise osv.except_osv(_('Cannot print!'), _('Cannot locate report setting for fiscal printing!')) if i['fiscalgr_print']: raise osv.except_osv(_('Cannot print!'), _('Cannot print invoice \"%s\" which is already printed !')%i['number']) #raise osv.except_osv(_('Invalid action !'), _('Cannot print such an invoice !')) #Then, iterate again, and issue those invoices for printing for i in invoices: - if fiscalgr_obj.print_invoice(cr,uid,i,self._name, i['type']): + if fiscalgr_obj.print_invoice(cr,uid,i,self._name, i['property_fiscalgr_invoice_report']): self.write(cr,uid,i['id'],{'state':'printed'}) logger.notifyChannel("fiscalgr", netsvc.LOG_INFO, 'printed invoice %s'%i['number']) diff --git a/addons/account_greek_fiscal/account_invoice_report.xml b/addons/account_greek_fiscal/account_invoice_report.xml new file mode 100644 index 00000000000..fd0d8f7141e --- /dev/null +++ b/addons/account_greek_fiscal/account_invoice_report.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/addons/account_greek_fiscal/fiscal_prints.py b/addons/account_greek_fiscal/fiscal_prints.py index 50a06c35bb5..432229fe256 100644 --- a/addons/account_greek_fiscal/fiscal_prints.py +++ b/addons/account_greek_fiscal/fiscal_prints.py @@ -38,9 +38,9 @@ class fiscal_print(osv.osv): } _defaults = { } - def print_invoice(self,cr,uid,inv_data,inv_model, inv_type): + def print_invoice(self,cr,uid,inv_data,inv_model, inv_report): logger=netsvc.Logger() - logger.notifyChannel("fiscalgr", netsvc.LOG_INFO, 'printing one %s invoice '%inv_type) + logger.notifyChannel("fiscalgr", netsvc.LOG_INFO, 'printing one %s invoice '%(type(inv_report))) fiscal_print() diff --git a/addons/account_greek_fiscal/wizard/__init__.py b/addons/account_greek_fiscal/wizard/__init__.py new file mode 100644 index 00000000000..f6188737d21 --- /dev/null +++ b/addons/account_greek_fiscal/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2008 P. Christeas. All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +import invoice_fiscalgr_print +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account_greek_fiscal/wizard/invoice_fiscalgr_print.py b/addons/account_greek_fiscal/wizard/invoice_fiscalgr_print.py new file mode 100644 index 00000000000..c3a79414158 --- /dev/null +++ b/addons/account_greek_fiscal/wizard/invoice_fiscalgr_print.py @@ -0,0 +1,61 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2008 P. Christeas. All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +import wizard +import time +import datetime +import pooler + +# *-* this code is still useless.. + +invoice_form = """ +
+