[FIX] website_sale_digital: find only move line related to products

Before this commit and since beaa30a3d1 it was not possible to download a
digital product.

The `search_read()` would return move line which does not have any `product_id`
which will later crash when accessing `product_id` in the for loop.

Search_read result would be:
[{'id': 20, 'product_id': (38, 'eBook: Office Renovation for Dummies')},
 {'id': 21, 'product_id': False},
 {'id': 22, 'product_id': False},
 {'id': 23, 'product_id': False}]

task-2063307

closes odoo/odoo#38225

X-original-commit: b045be2814cee96c9723f0c9d07462e07cab4773
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Romain Derie
2019-10-08 15:08:04 +00:00
committed by fw-bot
parent 8488e6c871
commit f53e751433
@@ -13,7 +13,11 @@ class AccountInvoiceLine(models.Model):
# Get paid invoices
purchases = self.sudo().search_read(
domain=[('move_id.invoice_payment_state', '=', 'paid'), ('move_id.partner_id', '=', partner.id)],
domain=[
('move_id.invoice_payment_state', '=', 'paid'),
('move_id.partner_id', '=', partner.id),
('product_id', '!=', False),
],
fields=['product_id'],
)