I want to validate order before finalize sale through odoo website. If order is not validated based on some conditions I want to show a warning message. What is the approach to show the warning message on website?
Note: Warning is not on address form validation but right before finalize sale.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
2
Respuestas
14613
Vistas
<!-- Add warning on website cart page --># Set Valid/invalid flag to show/hide warning
@http.route(['/shop/cart'], type='http', auth="public", website=True)
def cart(self, **post):
order = request.website.sale_get_order()
valid = True
if :
valid = False
values = {
'website_sale_order': order,
'compute_currency': compute_currency,
'suggested_products': [],
'valid':valid,
}
return request.render("website_sale.cart", values)
# fallback to "/shop/cart" if order not valid
@http.route(['/shop/checkout'], type='http', auth="public", website=True)
def checkout(self, **post):
order = request.website.sale_get_order()
if order.company_id.sale_freight_warning == 's' and len(set([line.product_id.has_frete for line in order.order_line if line.product_id])) > 1:
return request.redirect("/shop/cart")
else:
return super(CorreiosL10nBrWebsiteSale, self).checkout(**post)
<template id="payment" inherit_id="website_sale.cart">
<xpath expr="//h1" position="after">
<t t-if="not valid">
<div class="alert alert-danger">
<strong>Wraning!</strong>
You can't buy product with freight & no freight together.
</div>
</t>
</xpath>
</template>
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
sept 17
|
5651 | ||
|
0
sept 17
|
3959 | ||
|
2
feb 21
|
7547 | ||
|
0
sept 17
|
2805 | ||
|
2
jul 25
|
4550 |
Please see this links,
https://stackoverflow.com/questions/34069000/how-can-i-raise-a-warning-message-in-odoo-website
https://stackoverflow.com/questions/35411608/odoo-generate-warning-pop-up-from-web-controller