| 1 |
|
| 2 |
|
| 3 |
from odoo.http import request, route |
| 4 |
|
| 5 |
from odoo.addons.website_sale.controllers import main |
| 6 |
|
| 7 |
|
| 8 |
class WebsiteSaleWishlist(main.WebsiteSale): |
| 9 |
|
| 10 |
def _get_additional_shop_values(self, values, **kwargs): |
| 11 |
""" Hook to update values used for rendering website_sale.products template """ |
| 12 |
vals = super()._get_additional_shop_values(values, **kwargs) |
| 13 |
vals['products_in_wishlist'] = request.env['product.wishlist'].current().product_id.product_tmpl_id |
| 14 |
return vals |
| 15 |
|
| 16 |
@route() |
| 17 |
def _change_website_config(self, **options): |
| 18 |
result = super()._change_website_config(**options) |
| 19 |
|
| 20 |
current_website = request.env['website'].get_current_website() |
| 21 |
|
| 22 |
wishlist_writable_fields = {'wishlist_opt_products_design_classes', 'wishlist_grid_columns', 'wishlist_mobile_columns', 'wishlist_gap'} |
| 23 |
|
| 24 |
wishlist_write_vals = {k: v for k, v in options.items() if k in wishlist_writable_fields} |
| 25 |
if wishlist_write_vals: |
| 26 |
current_website.write(wishlist_write_vals) |
| 27 |
|
| 28 |
return result |