[FIX] sale_stock: canceled invoice
- Create a Sale Order with a product - Confirm and deliver the product, create an invoice. - Cancel that invoice, go back to the SO. - Recreate the invoice, you have 2 of them (one cancelled). - Post the second, and try 'Send and print' and 'Preview'. A traceback is raised. The traceback arises because we sort on the `invoice_date`, which is `False` for a canceled invoice. Actually, we should not take into account canceled invoices. opw-2119870 closes odoo/odoo#40215 X-original-commit: 6f304973785669f1c3b297c96eb8be7de7242ebe Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
fw-bot
parent
82a24aa1df
commit
3bc330a323
@@ -32,7 +32,7 @@ class AccountMove(models.Model):
|
||||
|
||||
# Get the other customer invoices and refunds.
|
||||
ordered_invoice_ids = sale_orders.mapped('invoice_ids')\
|
||||
.filtered(lambda i: i.state != 'draft')\
|
||||
.filtered(lambda i: i.state not in ['draft', 'cancel'])\
|
||||
.sorted(lambda i: (i.invoice_date, i.id))
|
||||
|
||||
# Get the position of self in other customer invoices and refunds.
|
||||
|
||||
Reference in New Issue
Block a user