From f83abfd04a6f74f8080045208be8959dcc68b3cf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jun 2013 16:23:08 +0200 Subject: [PATCH 1/2] =?UTF-8?q?[MRG]=C2=A0fix=20bug=201189922=20that=20pre?= =?UTF-8?q?vents=20validation=20of=200%=20export=20tax=20invoices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account_constraints/account_constraints.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_constraints/account_constraints.py b/account_constraints/account_constraints.py index 419ffcb95..6497cc1d0 100644 --- a/account_constraints/account_constraints.py +++ b/account_constraints/account_constraints.py @@ -122,8 +122,10 @@ class AccountMoveLine(orm.Model): def _check_currency_and_amount(self, cr, uid, ids, context=None): for l in self.browse(cr, uid, ids, context=context): - if ((l.currency_id and not l.amount_currency) or - (not l.currency_id and l.amount_currency)): + # we check zero amount line + if not bool(l.debit) + bool(l.credit): + continue + if (bool(l.currency_id) != bool(l.amount_currency)): return False return True From aba6a6deb391e9c6d2b9a20e4df00cf9a58192a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Jul 2013 10:33:18 +0200 Subject: [PATCH 2/2] [IMP] code styling --- account_constraints/account_constraints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_constraints/account_constraints.py b/account_constraints/account_constraints.py index 6497cc1d0..bd20e27a3 100644 --- a/account_constraints/account_constraints.py +++ b/account_constraints/account_constraints.py @@ -123,9 +123,9 @@ class AccountMoveLine(orm.Model): def _check_currency_and_amount(self, cr, uid, ids, context=None): for l in self.browse(cr, uid, ids, context=context): # we check zero amount line - if not bool(l.debit) + bool(l.credit): + if not (l.debit and l.credit): continue - if (bool(l.currency_id) != bool(l.amount_currency)): + if bool(l.currency_id) != bool(l.amount_currency): return False return True