[FIX] point_of_sale: partner_id on split move lines

Have a payment method [PAYMENT] on POS with split transactions enabled.
Make a POS sale to a specific customer, pay with [PAYMENT].
Close and validate the session.

While the accounting entry for the POS sale will have the partner set,
this is not the case for the entries related to the payment.

opw-2307973

closes odoo/odoo#56142

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-08-21 09:14:15 +00:00
parent dba5a8388d
commit d4d03711c5
+6 -1
View File
@@ -574,7 +574,7 @@ class PosSession(models.Model):
split_cash_receivable_vals = defaultdict(list)
for payment, amounts in split_receivables_cash.items():
statement = statements_by_journal_id[payment.payment_method_id.cash_journal_id.id]
split_cash_statement_line_vals[statement].append(self._get_statement_line_vals(statement, payment.payment_method_id.receivable_account_id, amounts['amount']))
split_cash_statement_line_vals[statement].append(self._get_split_statement_line_vals(statement, payment, amounts['amount']))
split_cash_receivable_vals[statement].append(self._get_split_receivable_vals(payment, amounts['amount'], amounts['amount_converted']))
# handle combine cash payments
combine_cash_statement_line_vals = defaultdict(list)
@@ -819,6 +819,11 @@ class PosSession(models.Model):
'counterpart_account_id': receivable_account.id,
}
def _get_split_statement_line_vals(self, statement, payment, amount):
res = self._get_statement_line_vals(statement, payment.payment_method_id.receivable_account_id, amount)
res['partner_id'] = self.env['res.partner']._find_accounting_partner(payment.partner_id).id
return res
def _update_amounts(self, old_amounts, amounts_to_add, date, round=True, force_company_currency=False):
"""Responsible for adding `amounts_to_add` to `old_amounts` considering the currency of the session.