[FIX] purchase: canceled bill in suggestion

- Install `account_cancel`
- Create a vendor bill for Partner A, cancel it
- Create a new vendor bill for A

The 'Auto-Complete' suggest a bill with an empty name, and only an
amount. It corresponds to the canceled bill.

On a canceled bill, the `number` field is empty, and consequently the
`name` is empty as well.

Whatever is the state of the bill, displaying a bill is useless is only
the amount is shown. Therefore, we make sure to only display the bills
with a number set.

opw-1950846

closes odoo/odoo#31863

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-03-15 09:32:34 +00:00
parent f8efc9a957
commit 547e6e37f4
+1 -1
View File
@@ -30,7 +30,7 @@ class PurchaseBillUnion(models.Model):
id as vendor_bill_id, NULL as purchase_order_id
FROM account_invoice
WHERE
type='in_invoice' and state in ('open','in_payment','paid','cancel')
type='in_invoice' and COALESCE(number, '') != ''
UNION
SELECT
-id, name, partner_ref, partner_id, date_order::date as date, amount_untaxed as amount, currency_id, company_id,