~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to funding_pool/analytic_account.py

UF-428 UF-429 [MERGE] lp:unifield-wm

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        'date_start': lambda *a: (datetime.datetime.today() + relativedelta(months=-3)).strftime('%Y-%m-%d')
45
45
    }
46
46
 
47
 
    def _check_unicity(self, cr, uid, ids, context={}):
48
 
        if not context:
49
 
            context={}
50
 
        for account in self.browse(cr, uid, ids, context=context):
51
 
            bad_ids = self.search(cr, uid, [('category', '=', account.category),('|'),('name', '=ilike', account.name),('code', '=ilike', account.code)])
52
 
            if len(bad_ids) and len(bad_ids) > 1:
53
 
                return False
54
 
        return True
 
47
    #def _check_unicity(self, cr, uid, ids, context={}):
 
48
    #    if not context:
 
49
    #        context={}
 
50
    #    for account in self.browse(cr, uid, ids, context=context):
 
51
    #        bad_ids = self.search(cr, uid, [('category', '=', account.category),('|'),('name', '=ilike', account.name),('code', '=ilike', account.code)])
 
52
    #        if len(bad_ids) and len(bad_ids) > 1:
 
53
    #            return False
 
54
    #    return True
55
55
 
56
 
    _constraints = [
57
 
        (_check_unicity, 'You cannot have the same code or name between analytic accounts in the same category!', ['code', 'name', 'category']),
58
 
    ]
 
56
    #_constraints = [
 
57
    #    (_check_unicity, 'You cannot have the same code or name between analytic accounts in the same category!', ['code', 'name', 'category']),
 
58
    #]
59
59
 
60
60
    def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
61
61
        account = self.browse(cr, uid, id, context=context)