Skip to content

Commit

Permalink
[FIX] account: Set the commercial partner on journal items from payments
Browse files Browse the repository at this point in the history
Since you can only reconcile entries from the same partner, you must always use
the commercial partner when creating some journal items.

closes odoo#44555

Signed-off-by: oco-odoo <[email protected]>
  • Loading branch information
smetl committed Feb 4, 2020
1 parent aab5cb4 commit 1ba501d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions addons/account/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def _prepare_payment_moves(self):
'debit': balance + write_off_balance > 0.0 and balance + write_off_balance or 0.0,
'credit': balance + write_off_balance < 0.0 and -balance - write_off_balance or 0.0,
'date_maturity': payment.payment_date,
'partner_id': payment.partner_id.id,
'partner_id': payment.partner_id.commercial_partner_id.id,
'account_id': payment.destination_account_id.id,
'payment_id': payment.id,
}),
Expand All @@ -569,7 +569,7 @@ def _prepare_payment_moves(self):
'debit': balance < 0.0 and -balance or 0.0,
'credit': balance > 0.0 and balance or 0.0,
'date_maturity': payment.payment_date,
'partner_id': payment.partner_id.id,
'partner_id': payment.partner_id.commercial_partner_id.id,
'account_id': liquidity_line_account.id,
'payment_id': payment.id,
}),
Expand All @@ -584,7 +584,7 @@ def _prepare_payment_moves(self):
'debit': write_off_balance < 0.0 and -write_off_balance or 0.0,
'credit': write_off_balance > 0.0 and write_off_balance or 0.0,
'date_maturity': payment.payment_date,
'partner_id': payment.partner_id.id,
'partner_id': payment.partner_id.commercial_partner_id.id,
'account_id': payment.writeoff_account_id.id,
'payment_id': payment.id,
}))
Expand Down Expand Up @@ -622,7 +622,7 @@ def _prepare_payment_moves(self):
'debit': balance < 0.0 and -balance or 0.0,
'credit': balance > 0.0 and balance or 0.0,
'date_maturity': payment.payment_date,
'partner_id': payment.partner_id.id,
'partner_id': payment.partner_id.commercial_partner_id.id,
'account_id': payment.company_id.transfer_account_id.id,
'payment_id': payment.id,
}),
Expand All @@ -634,7 +634,7 @@ def _prepare_payment_moves(self):
'debit': balance > 0.0 and balance or 0.0,
'credit': balance < 0.0 and -balance or 0.0,
'date_maturity': payment.payment_date,
'partner_id': payment.partner_id.id,
'partner_id': payment.partner_id.commercial_partner_id.id,
'account_id': payment.destination_journal_id.default_credit_account_id.id,
'payment_id': payment.id,
}),
Expand Down

0 comments on commit 1ba501d

Please sign in to comment.