Compare commits
2 Commits
2165dac603
...
dc05cf3ff1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc05cf3ff1 | ||
|
|
3403c479a4 |
Binary file not shown.
@ -53,8 +53,20 @@ class EventRentalController(http.Controller):
|
||||
}
|
||||
return request.render('event_rental.rental_catalog_template', values)
|
||||
|
||||
@http.route('/rentals/<model("product.template"):product>', type='http', auth='public', website=True)
|
||||
def rental_product_detail(self, product, **post):
|
||||
@http.route('/rentals/<string:product_slug>', type='http', auth='public', website=True)
|
||||
def rental_product_detail(self, product_slug, **post):
|
||||
try:
|
||||
if '-' in product_slug:
|
||||
product_id = int(product_slug.split('-')[-1])
|
||||
else:
|
||||
product_id = int(product_slug)
|
||||
except (ValueError, IndexError):
|
||||
return request.not_found()
|
||||
|
||||
product = request.env['product.template'].sudo().browse(product_id)
|
||||
if not product or not product.exists() or not product.is_rental:
|
||||
return request.not_found()
|
||||
|
||||
return request.render('event_rental.rental_product_detail_template', {'product': product})
|
||||
|
||||
@http.route('/rental/request', type='http', auth='public', website=True, methods=['GET', 'POST'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user