~credativ/account-banking/fix-variable-error-6.0

« back to all changes in this revision

Viewing changes to account_banking_nl_clieop/wizard/export_clieop.py

  • Committer: Stefan Rijnhart
  • Date: 2011-04-26 20:41:31 UTC
  • Revision ID: stefan@therp.nl-20110426204131-hdtg529l979n9wdl
Migration to OpenERP 6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
        pool = pooler.get_pool(cursor.dbname)
197
197
        payment_order_obj = pool.get('payment.order')
198
198
 
 
199
        # Can get id from context. Seems necessary due to lack of support for
 
200
        # old style wizards in the GTK client
 
201
        if 'ids' not in data and context.get('payment_order_id', False):
 
202
            data['ids'] = [context['payment_order_id']]
 
203
 
199
204
        runs = {}
200
205
        # Only orders of same type can be combined
201
206
        payment_orders = payment_order_obj.browse(cursor, uid, data['ids'])
362
367
 
363
368
    def _save_clieop(self, cursor, uid, data, context):
364
369
        '''
365
 
        Save the ClieOp: mark all payments in the file as 'sent'.
 
370
        Save the ClieOp: mark all payments in the file as 'sent', if not a test
366
371
        '''
367
 
        pool = pooler.get_pool(cursor.dbname)
368
 
        clieop_obj = pool.get('banking.export.clieop')
369
 
        payment_order_obj = pool.get('payment.order')
370
 
        clieop_file = clieop_obj.write(
371
 
            cursor, uid, data['file_id'], {'state':'sent'}
372
 
        )
373
 
        payment_order_obj.write(cursor, uid, data['ids'], {'state': 'sent'})
 
372
        if 'test' not in data['form'] or not data['form']['test']:
 
373
            pool = pooler.get_pool(cursor.dbname)
 
374
            clieop_obj = pool.get('banking.export.clieop')
 
375
            payment_order_obj = pool.get('payment.order')
 
376
            clieop_file = clieop_obj.write(
 
377
                cursor, uid, data['file_id'], {'state':'sent'}
 
378
                )
 
379
            payment_order_obj.action_sent(cursor, uid, data['ids'])
374
380
        return {'state': 'end'}
375
381
 
376
382
    states = {
394
400
                'fields': file_fields,
395
401
                'state': [
396
402
                    ('cancel', 'Cancel', 'gtk-cancel'),
397
 
                    ('save', 'Save', 'gtk-save'),
 
403
                    ('save', 'Finish', 'gtk-ok'),
398
404
                ]
399
405
            },
400
406
        },