*: website_event, website_event_sale, website_forum, website_sale, website_sale_slides, website_slides, website_slides_forum This commit removes the remaining controllers that are no longer used since the use of form views on website new content dialogs (following the website in backend merge at [1] and the many iterations afterwards). With the website in backend work, a feature was lost for the creation of events: dummy tickets were created. This commit actually removes the feature for good. Events default values are managed by templates. Moreover there are links in frontend to edit the event when being allowed to edit it (event groups), notably when there is no ticket in registration page. So it makes no sense to create dummy tickets, without price, for 1000 seats. Those values are random so they will have to be edited. Better let users create real tickets if necessary, than editing and/or removing dummy tickets. [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2687506 closes odoo/odoo#102928 X-original-commit: d559ce5d1518ac1293db1c4f52efb8094daf5b49 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: qsm-odoo <qsm@odoo.com>
34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.website_slides.controllers.main import WebsiteSlides
|
|
from odoo.http import request, route
|
|
from odoo.tools import format_amount
|
|
|
|
|
|
class WebsiteSaleSlides(WebsiteSlides):
|
|
|
|
@route('/slides/get_course_products', type='json', auth='user')
|
|
def get_course_products(self):
|
|
"""Return a list of the course products values with formatted price."""
|
|
products = request.env['product.product'].search([('detailed_type', '=', 'course')])
|
|
|
|
return [{
|
|
'id': product.id,
|
|
'name': f'{product.name} ({format_amount(request.env, product.list_price, product.currency_id)})',
|
|
} for product in products]
|
|
|
|
def _prepare_additional_channel_values(self, values, **kwargs):
|
|
values = super(WebsiteSaleSlides, self)._prepare_additional_channel_values(values, **kwargs)
|
|
channel = values['channel']
|
|
if channel.enroll == 'payment':
|
|
# search the product to apply ACLs, notably on published status, to avoid access errors
|
|
product = request.env['product.product'].search([('id', '=', channel.product_id.id)]) if channel.product_id else request.env['product.product']
|
|
if product:
|
|
pricelist = request.website.get_current_pricelist()
|
|
values['product_info'] = channel.product_id.product_tmpl_id._get_combination_info(product_id=channel.product_id.id, pricelist=pricelist)
|
|
values['product_info']['currency_id'] = request.website.currency_id
|
|
else:
|
|
values['product_info'] = False
|
|
return values
|