[FIX] website_sale_digital: portal files as digital products

Currently, when a digital product is purchased, the list of attachments
is incorrectly computed. Product template's portal files are retrieved
correctly, but all product variant's attachments are taken into account,
not only its portal files.

This commit causes the portal attachments to be computed correctly,
taking into account only portal files from both the product template and
product variant.

Closes #25609
This commit is contained in:
Luis González
2018-08-03 10:41:02 +02:00
committed by Nicolas Martinelli
parent b3bcfbde1b
commit b623695ee7
@@ -44,7 +44,7 @@ class WebsiteSaleDigital(CustomerPortal):
product_id = product.id
template = product.product_tmpl_id
att = Attachment.search_read(
domain=['|', '&', ('res_model', '=', product._name), ('res_id', '=', product_id), '&', ('res_model', '=', template._name), '&', ('res_id', '=', template.id), ('product_downloadable', '=', True)],
domain=['|', '&', ('res_model', '=', product._name), ('res_id', '=', product_id), '&', ('res_model', '=', template._name), ('res_id', '=', template.id), ('product_downloadable', '=', True)],
fields=['name', 'write_date'],
order='write_date desc',
)