~banking-addons-team/banking-addons/6.1-dev

« back to all changes in this revision

Viewing changes to account_banking_uk_hsbc/wizard/export_hsbc.py

  • Committer: James Jesudason
  • Date: 2012-03-22 12:07:57 UTC
  • Revision ID: james.jesudason@canonical.com-20120322120757-n93b5tw1bz5xjfoy
[FIX] Payments from a Canadian bank account need the HSBC 6-digit sort-code number

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        return super(banking_export_hsbc_wizard, self).create(
140
140
            cursor, uid, wizard_data, context)
141
141
 
142
 
    def _create_account(self, oe_account):
 
142
    def _create_account(self, oe_account, origin_country=None, is_origin_account=False):
143
143
        currency = None # let the receiving bank select the currency from the batch
144
144
        holder = oe_account.owner_name or oe_account.partner_id.name
145
145
        self.logger.info('Create account %s' % (holder))
191
191
                currency=currency,
192
192
                swiftcode=oe_account.bank.bic,
193
193
                country=oe_account.country_id.code,
194
 
                #origin_country=origin_country
 
194
                origin_country=origin_country,
 
195
                is_origin_account=is_origin_account
195
196
            )
196
197
            transaction_kwargs = {
197
198
                'charges': paymul.CHARGES_PAYEE,
237
238
            )
238
239
        
239
240
        self.logger.info('====')
240
 
        dest_account, transaction_kwargs = self._create_account(line.bank_id)
 
241
        dest_account, transaction_kwargs = self._create_account(line.bank_id, line.order_id.mode.bank_id.country_id.code)
241
242
 
242
243
        means = {'ACH or EZONE': paymul.MEANS_ACH_OR_EZONE,
243
244
                 'Faster Payment': paymul.MEANS_FASTER_PAYMENT,
278
279
        try:
279
280
            self.logger.info('Source - %s (%s) %s' % (payment_orders[0].mode.bank_id.partner_id.name, payment_orders[0].mode.bank_id.acc_number, payment_orders[0].mode.bank_id.country_id.code))
280
281
            src_account = self._create_account(
281
 
                payment_orders[0].mode.bank_id,
 
282
                payment_orders[0].mode.bank_id, payment_orders[0].mode.bank_id.country_id.code, is_origin_account=True
282
283
            )[0]
283
284
        except ValueError as exc:
284
285
            raise osv.except_osv(