Dharti Ratani(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-1094227-dhr into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) Related bugs: Bug #1094227 in OpenERP Addons: "[6.1 / 7.0 / trunk] bank statements with the duplicate numbers" https://bugs.launchpad.net/openobject-addons/+bug/1094227 For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1094227-dhr/+merge/141712 Hello, Added unique name constraint for bank statements to avoid bank statements with duplicate numbers. Thanks Dhr -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1094227-dhr/+merge/141712 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-1094227-dhr.
=== modified file 'account/account_bank_statement.py' --- account/account_bank_statement.py 2012-12-20 11:54:56 +0000 +++ account/account_bank_statement.py 2013-01-03 13:10:28 +0000 @@ -145,8 +145,17 @@ return False return True + def _check_unique_name(self, cr, uid, ids, context=None): + statement_ids = self.search(cr, uid, [], context=context) + for bank_statement in self.browse(cr, uid, ids, context=context): + statement_ids.remove(bank_statement.id) + if bank_statement.name != '/' and bank_statement.name in [statement.name for statement in self.browse(cr, uid, statement_ids, context=context)]: + return False + return True + _constraints = [ (_check_company_id, 'The journal and period chosen have to belong to the same company.', ['journal_id','period_id']), + (_check_unique_name, 'The name of Bank statement must be unique.', ['name']), ] def onchange_date(self, cr, uid, ids, date, company_id, context=None):
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp