From b5f0ba02530c10bf80dd35df99450da4ee44eacf Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 6 Mar 2009 11:34:28 +0100 Subject: [PATCH] modifs bzr revid: fp@tinyerp.com-20090306103428-ccn7up41lkxov20c --- addons/account/invoice.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index bb2dca8b3b3..d64ba93c089 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -290,15 +290,30 @@ class account_invoice(osv.osv): } def unlink(self, cr, uid, ids, context=None): - invoices = self.read(cr, uid, ids, ['state']) - unlink_ids = [] - for t in invoices: - if t['state'] in ('draft', 'cancel'): - unlink_ids.append(t['id']) - else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened or paid !')) - osv.osv.unlink(self, cr, uid, unlink_ids, context=context) - return True + for inv in self.browse(cr, uid, ids, context): + print inv.name, inv.amount_total + for line in inv.invoice_line: + print line.price_subtotal +# invoices = self.read(cr, uid, ids, ['state']) +# unlink_ids = [] +# for t in invoices: +# if t['state'] in ('draft', 'cancel'): +# unlink_ids.append(t['id']) +# else: +# raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened or paid !')) +# osv.osv.unlink(self, cr, uid, unlink_ids, context=context) +# return True + + #def unlink(self, cr, uid, ids, context=None): + # invoices = self.read(cr, uid, ids, ['state']) + # unlink_ids = [] + # for t in invoices: + # if t['state'] in ('draft', 'cancel'): + # unlink_ids.append(t['id']) + # else: + # raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened or paid !')) + # osv.osv.unlink(self, cr, uid, unlink_ids, context=context) + # return True # def get_invoice_address(self, cr, uid, ids): # res = self.pool.get('res.partner').address_get(cr, uid, [part], ['invoice'])