[FIX] account: partner_id set on a bank fee
Used case: -Create several customer invoices and validate them -Register a payment without any partner_id and in a bank statement for an amount a bit lower than the total of the invoice (the difference is the paypal fees) -Reconcile the invoices with the payment and create a write-off for the paypal fees -When you close the bank statement, check the journal items, the paypal fees are automatically assigned with a partner. Fix: -When creating the account move line for the fee, if all the account move lines linked to the move are for different partners then you cannot determine the partner of the fee. opw:674822
This commit is contained in:
parent
0af32f3f84
commit
08416b2335
|
@ -275,8 +275,9 @@ class account_move_line(osv.osv):
|
|||
#we propose to continue the same move by copying the ref, the name, the partner...
|
||||
move = move_obj.browse(cr, uid, move_id, context=context)
|
||||
data.setdefault('name', move.line_id[-1].name)
|
||||
same_partner = len({l.partner_id for l in move.line_id}) == 1
|
||||
for l in move.line_id:
|
||||
data['partner_id'] = data.get('partner_id') or l.partner_id.id
|
||||
data['partner_id'] = data.get('partner_id') or (same_partner and l.partner_id.id)
|
||||
data['ref'] = data.get('ref') or l.ref
|
||||
total += (l.debit or 0.0) - (l.credit or 0.0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue