From 47225077bd606f16a66901d26c8df6f1bc83cd31 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Thu, 28 Oct 2010 15:24:07 +0300 Subject: [PATCH] Greek fiscal: mark the print in the account.invoice. Now, account.invoice(s) will have to check whether they have been printed in the fiscal printer. bzr revid: p_christ@hol.gr-20101028122407-v8wqqvrvw8n84c03 --- addons/account_greek_fiscal/__init__.py | 1 + .../account_invoice_print.py | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 addons/account_greek_fiscal/account_invoice_print.py diff --git a/addons/account_greek_fiscal/__init__.py b/addons/account_greek_fiscal/__init__.py index 8009cace3c2..0975d02fea4 100644 --- a/addons/account_greek_fiscal/__init__.py +++ b/addons/account_greek_fiscal/__init__.py @@ -21,6 +21,7 @@ ############################################################################## import fiscal_prints +import account_invoice_print # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_greek_fiscal/account_invoice_print.py b/addons/account_greek_fiscal/account_invoice_print.py new file mode 100644 index 00000000000..bf2754ef9cf --- /dev/null +++ b/addons/account_greek_fiscal/account_invoice_print.py @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). 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 . +# +############################################################################## + +from osv import fields, osv + +class account_invoice(osv.osv): + _inherit = "account.invoice" + _columns = { + # states={'open':[('readonly',False)]} + 'fiscalgr_print': fields.many2one('account.fiscalgr.print','Fiscal print', readonly=True, ), + } + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default = default.copy() + default.update({'fiscalgr_print':None,}) + return super(account_invoice, self).copy(cr, uid, id, default, context) + + def action_cancel(self, cr, uid, ids, *args): + #account_move_obj = self.pool.get('account.move') + invoices = self.read(cr, uid, ids, ['fiscalgr_print']) + for i in invoices: + if i['fiscalgr_print']: + raise osv.except_osv(_('Invalid action !'), _('Cannot cancel invoice(s) which are already printed !')) + return super(account_invoice,self).action_cancel(cr,uid,ids,args) + +account_invoice() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +