Skip to content
Snippets Groups Projects
Commit ad7d4b68 authored by Adrien Guilliams (adgu)'s avatar Adrien Guilliams (adgu)
Browse files

[FIX] point_of_sale: restore payment method in invoice


Accounting moved the logic of _get_reconciled_vals
into _compute_payments_widget_reconciled_info but did not made the
change in point_of_sale.
This commit resolve this by putting the logic of the previous
_get_reconciled_vals into an override of the
_compute_payments_widget_reconciled_info method.
This is done because this is a legal requirement in France to have and
maybe in other countries.

closes odoo/odoo#133655

Signed-off-by: default avatarRobin Heinz (rhe) <rhe@odoo.com>
parent 2031e5e9
No related branches found
No related tags found
No related merge requests found
......@@ -43,13 +43,19 @@ class AccountMove(models.Model):
return lot_values
def _get_reconciled_vals(self, partial, amount, counterpart_line):
def _compute_payments_widget_reconciled_info(self):
"""Add pos_payment_name field in the reconciled vals to be able to show the payment method in the invoice."""
result = super()._get_reconciled_vals(partial, amount, counterpart_line)
if counterpart_line.move_id.sudo().pos_payment_ids:
pos_payment = counterpart_line.move_id.sudo().pos_payment_ids
result['pos_payment_name'] = pos_payment.payment_method_id.name
return result
super()._compute_payments_widget_reconciled_info()
for move in self:
if move.invoice_payments_widget:
if move.state == 'posted' and move.is_invoice(include_receipts=True):
reconciled_partials = move._get_all_reconciled_invoice_partials()
for i, reconciled_partial in enumerate(reconciled_partials):
counterpart_line = reconciled_partial['aml']
pos_payment = counterpart_line.move_id.sudo().pos_payment_ids
move.invoice_payments_widget['content'][i].update({
'pos_payment_name': pos_payment.payment_method_id.name,
})
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment