from addons.sale.controllers.product_configurator import ProductConfiguratorController
from odoo import fields, http, tools
from odoo.http import request
class WebsiteSaleInherit(ProductConfiguratorController):
@http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True,
sitemap=False)
def pricelist_change(self, pl_id, **post):
print('pl_id in super function', pl_id)
if (pl_id.selectable or pl_id == request.env.user.partner_id.property_product_pricelist) \
and request.website.is_pricelist_available(pl_id.id):
request.session['website_sale_current_pl'] = pl_id.id
request.website.sale_get_order(force_pricelist=pl_id.id)
sample = request.env['product.pricelist.item'].sudo().search([])
#I need to pass sample to XML file , I have used .qcontext but it doesnt worked
return request.redirect(request.httprequest.referrer or '/shop')XML file<odoo><data><template id="products_stock_discount" inherit_id="website_sale.products_item" name="Product discount">
<xpath expr='//div[hasclass("oe_product_image")]' position='before'>
<t t-foreach="order" t-as="items">
<div style="z-index: 20;" class="ribbon btn btn-danger oe_inline float-right">
<t t-esc="items.percent_price"/>% Offer
</div>
</t>
</xpath>
</template></data></odoo>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
2
Trả lời
8695
Lượt xem
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 8 19
|
8647 | ||
|
2
thg 7 25
|
6034 | ||
|
0
thg 1 24
|
1728 | ||
|
0
thg 9 22
|
803 | ||
|
0
thg 2 22
|
1830 |
See this: https://www.youtube.com/watch?v=1zy4kswo6gY
Thanks
Its working....But when i give
return request.redirect(request.httprequest.referrer or '/shop'), its not working
how could it can pass through request.redirect