[FIX] account,point_of_sale: Set invoice 'paid' directly when fully reconciled wo payments
When the invoice is fully reconciled but not using payments, set the 'paid' status on invoices. closes odoo/odoo#61339 X-original-commit: 052324cca4ec8682f065a4158e86fc113b0242e0 Related: odoo/enterprise#14590 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -1270,7 +1270,8 @@ class AccountMove(models.Model):
|
||||
if move.is_invoice(include_receipts=True) and move.state == 'posted':
|
||||
|
||||
if currency.is_zero(move.amount_residual):
|
||||
if all(payment.is_matched for payment in move._get_reconciled_payments()):
|
||||
reconciled_payments = move._get_reconciled_payments()
|
||||
if not reconciled_payments or all(payment.is_matched for payment in reconciled_payments):
|
||||
new_pmt_state = 'paid'
|
||||
else:
|
||||
new_pmt_state = move._get_invoice_in_payment_state()
|
||||
|
||||
@@ -17,11 +17,6 @@ class AccountMove(models.Model):
|
||||
stock_moves += invoice.sudo().mapped('pos_order_ids.picking_ids.move_lines').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'customer')
|
||||
return stock_moves
|
||||
|
||||
def _compute_amount(self):
|
||||
super(AccountMove, self)._compute_amount()
|
||||
pos_invoices = self.filtered(lambda i: i.move_type in ['out_invoice', 'out_refund'] and i.pos_order_ids)
|
||||
for invoice in pos_invoices:
|
||||
invoice.payment_state = 'paid'
|
||||
|
||||
def _get_invoiced_lot_values(self):
|
||||
self.ensure_one()
|
||||
|
||||
Reference in New Issue
Block a user