diff options
| author | Romain Derie <rde@odoo.com> | 2019-10-07 10:57:49 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-08 15:08:04 +0000 |
| commit | f53e751433fa66ae2880a6ddefa44ee1fa93bae8 (patch) | |
| tree | 47fd2b8f24b48dee1431bc1e7c7bdb074ed30808 | |
| parent | 8488e6c871eba7c71915ee14a15852834a26c8be (diff) | |
[FIX] website_sale_digital: find only move line related to products
Before this commit and since beaa30a3d184 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>
| -rw-r--r-- | addons/website_sale_digital/models/account_invoice.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/website_sale_digital/models/account_invoice.py b/addons/website_sale_digital/models/account_invoice.py index 4ca091914c7..5d5e350912e 100644 --- a/addons/website_sale_digital/models/account_invoice.py +++ b/addons/website_sale_digital/models/account_invoice.py @@ -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'], ) |
