~therp-nl/banking-addons/6.1-bank_statement_instant_voucher

« back to all changes in this revision

Viewing changes to account_banking/account_banking.py

  • Committer: James Jesudason
  • Date: 2012-02-20 19:41:49 UTC
  • Revision ID: james.jesudason@canonical.com-20120220194149-va9ea00vjyhsldr4
[ADD] Set company_id in context to ensure that the right period is found.
[FIX] Set local_currency on the transaction lines from the statement local_currency.
[ADD} Allow selection of analytic account for the statement line move and the write-off.
[FIX] Use currency name lookup on the journal, not currency id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
351
351
        st = st_line.statement_id
352
352
 
353
353
        context.update({'date': st_line.date})
 
354
        ctxt = context.copy()                       # AB
 
355
        ctxt['company_id'] = st_line.company_id.id  # AB
354
356
        period_id = self._get_period(
355
 
            cr, uid, st_line.date, context=context) # AB
 
357
            cr, uid, st_line.date, context=ctxt)    # AB
356
358
 
357
359
        move_id = account_move_obj.create(cr, uid, {
358
360
            'journal_id': st.journal_id.id,
364
366
            'move_ids': [(4, move_id, False)]
365
367
        })
366
368
 
 
369
        torec = []
367
370
        if st_line.amount >= 0:
368
371
            account_id = st.journal_id.default_credit_account_id.id
369
372
        else:
411
414
 
412
415
        move_line_id = account_move_line_obj.create(
413
416
            cr, uid, val, context=context)
414
 
        torec = move_line_id
 
417
        torec.append(move_line_id)
415
418
 
416
419
        # Fill the secondary amount/currency
417
420
        # if currency is not the same than the company
454
457
        - Pay invoices through workflow 
455
458
        """
456
459
        if st_line.reconcile_id:
457
 
            account_move_line_obj.write(cr, uid, [torec], {
 
460
            account_move_line_obj.write(cr, uid, torec, {
458
461
                    (st_line.reconcile_id.line_partial_ids and 
459
462
                     'reconcile_partial_id' or 'reconcile_id'): 
460
463
                    st_line.reconcile_id.id }, context=context)