From 4f3f094370aa9a485f44b0f7391cadb988e7a6e3 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 11 Nov 2015 01:09:30 +0100 Subject: [PATCH] FIX better handling of account_id in transfer move --- .../model/account_payment.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/account_banking_payment_transfer/model/account_payment.py b/account_banking_payment_transfer/model/account_payment.py index 0748c79c6..42a1c1d14 100644 --- a/account_banking_payment_transfer/model/account_payment.py +++ b/account_banking_payment_transfer/model/account_payment.py @@ -169,10 +169,15 @@ class PaymentOrder(models.Model): def _prepare_move_line_partner_account(self, bank_line, move, labels): # TODO : ALEXIS check don't group if move_line_id.account_id # is not the same - if self.payment_order_type == 'debit': - account_id = bank_line.partner_id.property_account_receivable.id + if bank_line.payment_line_ids[0].move_line_id: + account_id =\ + bank_line.payment_line_ids[0].move_line_id.account_id.id else: - account_id = bank_line.partner_id.property_account_payable.id + if self.payment_order_type == 'debit': + account_id =\ + bank_line.partner_id.property_account_receivable.id + else: + account_id = bank_line.partner_id.property_account_payable.id vals = { 'name': _('%s line %s') % ( labels[self.payment_order_type], bank_line.name),