From d106d5631e33784ad85bcc43cc71dda5529bd0db Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Wed, 18 Aug 2021 18:42:29 +0200 Subject: [PATCH] INit module --- __manifest__.py | 1 + controllers/__pycache__/main.cpython-37.pyc | Bin 1587 -> 1791 bytes controllers/main.py | 6 +++ views/template.xml | 55 ++++++++++---------- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/__manifest__.py b/__manifest__.py index 302260e..d75bcc4 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -14,5 +14,6 @@ ], "data": [ 'views/res_config_settings_views.xml', + 'views/template.xml', ], } diff --git a/controllers/__pycache__/main.cpython-37.pyc b/controllers/__pycache__/main.cpython-37.pyc index c72acb8d0ca9be81a38db14e3f94a604a21711f1..1c498fa880a4aabdf4f61a9e5cf8b3194a904496 100644 GIT binary patch delta 833 zcmdnY^PiW`iI<m)fq{YHthsDrFxNyr3C56#>grx83@I!*Y`N@F?2HWV3@NNBY%L5a zY^m(c%u(#_3@Pj>94!nf9I33$%u%c<oWTs5TrWYUXfobn$tWo)&}6*DUX)r`np#{k zv9XYmb>e3)J~jph24)5Z25trhhT@RP-i(s<CCphY3s@I2)Uu{9*05x;r7+nr)Ual; zgT%8qvKfm4QkY@l5HT>1#fG7VC73~z)z2-8KQBMNAhEbOz96wOH#M&$<Q7k2ZhmQA zNqkObZf1!l=PlOa(t^~YB31?lhFdJjiA5zvAXgM|GB6l0+~O-v%t?(;Pc4bhFG@)* zy2VkLoS#>cT2TTwrX;^4F{g-!fq_AjZE_={I{PhFu+qsZ81qf|7#J8pQpF$!1Ctmd z7b6!V9~f5&g{LMJXO^To=a&}b=jnlL)@1T4;-2itWM&Iee~ULhJ~=0`xHvgACnr9> zNRokp0ZeEz7D<5EQXm54Zcq#rvoJ6)a4?B57O_s=!qmXXGTD?_Nf{KVw^#!FgF`~x zG+B$-K{_}<K4s5MEy>7FDK6riT*d4r&kK?OnQ%)0<dFE%f|SIP)cCC8{5(zeBB9Cm znN6g{Kz@W;4R#CIeia4=2Fb~KEFC@wGq{n=&}1tT0vWCfBGf^I2FQM<?D8V)25K`f zFvv}2V%4kH0;y&M*~(EQ4PwiH2w4!p1R~@>1jzm(ke(uW5Etw)5P=d%AfJhY(iO<> z984070xS}YMIcc>O^#bE`6>DNMIa+@ae|n7pd?zvJb6B={v<Y*$(LC5OhKUx4tpd5 c<o#P5Ho5sJr8%i~Aj6755y8U<hRg!I00n)shyVZp delta 624 zcmey*yP1d2iI<m)fq{X6gGDw`igO~L1f$19b#-HRh7^_*))s~o)>PJJ<|tNoh7`6G z_7;W|_EhF(<|yVAj$j5&&X*vanvAztGD=DcCeA2iWSPvx=;gx7z`(%Fz`(%Gz`#%} z#lXN&!cf9k!_dr>#Z<#s!<5EU!`#PM%TmJ<%%I8Wr^$SawYan(wWx@Nfq~%`OLAgS zi6-l0EhhEJ5ls04JTQYmvJ6aOlOHlkGICA+&17Z^lDfqkAD^6)SX`W(nv)YBUnI=H zzyKyR8H<EKY!MIv(#r{Q4T!<PB*Iw4GC7aAfsuLgduAnNkb7^j1o#Jsgt%$47O{bJ zu!G#fo|{^dk)Kjr#4*`~#f=T*pCabT4J;Cjypw0Lm`DpUFfhRE0b2~VOpbwpL3r{D zmJT0?29QbIAYa9o7NjJWq-wGi@q(<72N8-OLJ6dVDZ9J~yMd|<3=9&J_ps{KtAJE9 zf^6j|5(TlvK!iAmU;+^mAOd865lBywB!~-k7>Izm6zoV){D5pL<^V-LlLVsxiv(j4 zNYqc0?G{UZN`8J3$jB&75K}KPB_%(vcycA1JR|eunQVr}pnwF2GZFzZ_!fsvZhlH> TPO2S91=w^RMjl2UW&sWWK22}F diff --git a/controllers/main.py b/controllers/main.py index be85507..c0682e0 100644 --- a/controllers/main.py +++ b/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 diff --git a/views/template.xml b/views/template.xml index 5d957f0..4e8bd57 100755 --- a/views/template.xml +++ b/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> -- GitLab