~therp-nl/banking-addons/ba7.0-RFR-split_off_payment_part

« back to all changes in this revision

Viewing changes to account_banking/parsers/models.py

  • Committer: Stefan Rijnhart
  • Date: 2012-01-17 08:48:10 UTC
  • Revision ID: stefan@therp.nl-20120117084810-5ihyjj1y3l1oh2t3
[IMP] ING/Triodos regain ability to generate friendly bank statement names
[RFR] API change: models.parser.parse() is now called with extra cursor argument
[IMP] models.parser.parse() can generate unique statement name

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
    country_code = None
341
341
    doc = __doc__
342
342
 
343
 
    def parse(self, data):
 
343
    def get_unique_statement_id(self, cr, base):
 
344
        name = base
 
345
        suffix = 1
 
346
        while True:
 
347
            cr.execute(
 
348
                "select id from account_bank_statement where name = %s",
 
349
                (name,))
 
350
            if not cr.rowcount:
 
351
                break
 
352
            suffix += 1
 
353
            name = "%s-%d" % (base, suffix)
 
354
        return name
 
355
 
 
356
    def parse(self, cr, data):
344
357
        '''
345
358
        Parse data.
346
359