Browse Source

INit module

12.0
Juliana 3 years ago
parent
commit
d106d5631e
  1. 1
      __manifest__.py
  2. BIN
      controllers/__pycache__/main.cpython-37.pyc
  3. 6
      controllers/main.py
  4. 55
      views/template.xml

1
__manifest__.py

@ -14,5 +14,6 @@
],
"data": [
'views/res_config_settings_views.xml',
'views/template.xml',
],
}

BIN
controllers/__pycache__/main.cpython-37.pyc

6
controllers/main.py

@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import http
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.addons.website_coupon.controllers.main import WebsiteCoupon
@ -11,6 +12,11 @@ class WebsiteCoupon(WebsiteCoupon):
@http.route(['/shop/cart'], type='http', auth="public", website=True, sitemap=False)
def cart(self, access_token=None, revive='', **post):
res = super(WebsiteCoupon, self).cart(access_token, revive, **post)
order = request.website.sale_get_order()
res.qcontext['no_pass_payment'] = False
if order.amount_total <= request.website.amount_limit:
res.qcontext['no_pass_payment'] = True
res.qcontext['amount_limit'] = request.website.amount_limit
return res

55
views/template.xml

@ -1,33 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="cart_lines" inherit_id="website_sale.cart_lines">
<xpath expr="//td[hasclass('text-center','td-qty')]" position="replace">
<t t-if="line.product_id.product_tmpl_id.is_coupon">
<td class="text-center td-qty">
<span class="js_quantity text-muted" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-esc="int(line.product_uom_qty)"/>
</td>
</t>
<t t-else="">
<td class="text-center td-qty">
<div t-if="not line.linked_line_id" class="css_quantity input-group mx-auto oe_website_spinner">
<div class="input-group-prepend">
<a t-attf-href="#" class="btn btn-link js_add_cart_json d-none d-md-inline-block" aria-label="Remove one" title="Remove one">
<i class="fa fa-minus"></i>
</a>
</div>
<input type="text" class="js_quantity form-control quantity" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-att-value="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty" />
<div class="input-group-append">
<a t-attf-href="#" class="btn btn-link float_left js_add_cart_json d-none d-md-inline-block" aria-label="Add one" title="Add one">
<i class="fa fa-plus"></i>
</a>
</div>
</div>
<t t-if="line.linked_line_id">
<span class="js_quantity text-muted" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-esc="int(line.product_uom_qty)"/>
</t>
</td>
</t>
<template id="cart" inherit_id="website_sale.cart">
<xpath expr="//a[hasclass('btn', 'btn-primary', 'float-right', 'd-none', 'd-xl-inline-block')]" position="replace">
<a role="button" t-if="website_sale_order and website_sale_order.website_order_line and not no_pass_payment" class="btn btn-primary float-right d-none d-xl-inline-block" href="/shop/checkout?express=1">
<span class="">Process Checkout</span>
<span class="fa fa-chevron-right" />
</a>
</xpath>
<xpath expr="//a[hasclass('btn', 'btn-primary', 'float-right')]" position="replace">
<a role="button" t-if="website_sale_order and website_sale_order.website_order_line and not no_pass_payment" class="btn btn-primary float-right" href="/shop/checkout?express=1">
<span class="">Process Checkout</span>
<span class="fa fa-chevron-right" />
</a>
</xpath>
<xpath expr="//div[hasclass('mt8', 'mb8', 'alert', 'alert-info')]" position="before">
<div t-if="no_pass_payment" class="alert alert-danger" role="alert">
<span>
Votre pannier doit être supérieur ou égal à <t t-esc="amount_limit"/> euros pour valider votre commande.
</span>
</div>
</xpath>
</template>
<template id="short_cart_summary" inherit_id="website_sale.short_cart_summary">
<xpath expr="//a[hasclass('btn', 'btn-secondary', 'float-right', 'd-none', 'd-xl-inline-block')]" position="replace">
<a role="button" t-if="website_sale_order and website_sale_order.website_order_line and not no_pass_payment" class="btn btn-secondary float-right d-none d-xl-inline-block" href="/shop/checkout?express=1">
<span>Process Checkout</span>
</a>
</xpath>
</template>
Loading…
Cancel
Save