From a2dbd69cd60d6449f7fd2b34f3b48b33a29f4b17 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 17 Sep 2011 14:55:37 +0200 Subject: [PATCH] [FIX] lp bug: https://launchpad.net/bugs/781585 fixed bzr revid: fp@tinyerp.com-20110917125537-y32aedueqdu7pc9o --- addons/account/account.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 57b3310a933..25618d8886f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2133,7 +2133,11 @@ class account_model(osv.osv): period_id = period_id[0] for model in self.browse(cr, uid, ids, context=context): - entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')} + try: + entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')} + except: + raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !')) + move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], 'period_id': period_id, @@ -2205,8 +2209,8 @@ class account_model_line(osv.osv): } _order = 'sequence' _sql_constraints = [ - ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model (Credit Or Debit Must Be "0")!'), - ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model (Credit + Debit Must Be greater "0")!'), + ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model, they must be positive!'), + ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model, they must be positive!'), ] account_model_line()