[FIX] point_of_sale: Payment term 30% Now, Balance 60 Days not supported in POS
Steps to reproduce the bug: - Let's consider a customer C with default sale payment term 30% Now, Balance 60 Days - Go to the POS and open a session - Select a product and set C as customer - Click on Payment and select Cash and check Invoice Bug: A traceback was raised because several account move lines are created. opw:3009062 closes odoo/odoo#103589 X-original-commit: 15f586b3dec5c951b10a7eea5aca219ad466da9b Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
committed by
Pierre Masereel
parent
baea953d24
commit
af6178e628
@@ -848,12 +848,11 @@ class PosOrder(models.Model):
|
||||
def _apply_invoice_payments(self):
|
||||
receivable_account = self.env["res.partner"]._find_accounting_partner(self.partner_id).with_company(self.company_id).property_account_receivable_id
|
||||
payment_moves = self.payment_ids.sudo().with_company(self.company_id)._create_payment_moves()
|
||||
invoice_receivable = self.account_move.line_ids.filtered(lambda line: line.account_id == receivable_account)
|
||||
# Reconcile the invoice to the created payment moves.
|
||||
# But not when the invoice's total amount is zero because it's already reconciled.
|
||||
if not invoice_receivable.reconciled and receivable_account.reconcile:
|
||||
payment_receivables = payment_moves.mapped('line_ids').filtered(lambda line: line.account_id == receivable_account and line.partner_id)
|
||||
(invoice_receivable | payment_receivables).sudo().with_company(self.company_id).reconcile()
|
||||
if receivable_account.reconcile:
|
||||
invoice_receivables = self.account_move.line_ids.filtered(lambda line: line.account_id == receivable_account and not line.reconciled)
|
||||
if invoice_receivables:
|
||||
payment_receivables = payment_moves.mapped('line_ids').filtered(lambda line: line.account_id == receivable_account and line.partner_id)
|
||||
(invoice_receivables | payment_receivables).sudo().with_company(self.company_id).reconcile()
|
||||
return payment_moves
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user