From 38a8b015a64f63842dd97cf7e91023621518714c Mon Sep 17 00:00:00 2001 From: Juliana Date: Thu, 19 Aug 2021 12:00:21 +0200 Subject: [PATCH] Ajout du controle pour passer au paiement --- __manifest__.py | 2 +- controllers/__pycache__/main.cpython-37.pyc | Bin 1791 -> 1881 bytes controllers/main.py | 39 ++++-------------- models/__pycache__/__init__.cpython-37.pyc | Bin 253 -> 0 bytes .../res_config_settings.cpython-37.pyc | Bin 615 -> 0 bytes models/__pycache__/website.cpython-37.pyc | Bin 507 -> 0 bytes models/product.py | 10 ----- views/product_views.xml | 17 -------- views/template.xml | 20 --------- 9 files changed, 8 insertions(+), 80 deletions(-) delete mode 100644 models/__pycache__/__init__.cpython-37.pyc delete mode 100644 models/__pycache__/res_config_settings.cpython-37.pyc delete mode 100644 models/__pycache__/website.cpython-37.pyc delete mode 100755 models/product.py delete mode 100755 views/product_views.xml diff --git a/__manifest__.py b/__manifest__.py index d75bcc4..69ec486 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ { "name": "VRACOOP - Website Cart Limit", "summary": "VRACOOP - Website Cart Limit", - "version": "12.0.1.0.1", + "version": "12.0.1.0.0", "development_status": "Beta", "author": "Le Filament", "maintainers": ["remi-filament"], diff --git a/controllers/__pycache__/main.cpython-37.pyc b/controllers/__pycache__/main.cpython-37.pyc index 1c498fa880a4aabdf4f61a9e5cf8b3194a904496..16bd31dd14519e9b1180c476785b7647e30d8d02 100644 GIT binary patch delta 939 zcmZuvPixdr5P$RX?+V7tk6pA&;}-%G-D?bp(uSTb`vl3fIVW;md*~7j`FsR(8E|r z7h_imjD_@CEU1j$Og7BI?)FqHQ_b;@g_R8kaauro^!_D?+=Cx=L3uOk=u8{v>T3QA zZopW6nSZkCnDFzjd>(4~Z+`n8#f9H)M{y@jBNfN(wmwIP2m;Vkgb8E=Wg;9kC6erHsBQ-4&2r8q&kJDJ@xfYs>Mnt|rHJT&%NqnaM&2 z2dirbn+|Kubak-aj8;{&HrU9@0kw-?mKOq3lfs%9=qiDa5CH-{TZ{%JD;eHGCu4os zP7~^R-uc63hRk8({Wv{>7SG;rc2yB;^C4FOWY?Fhf8q zsV@@He40+_S%UxX6x}*$l-da5`mED{lIdbl$(QV@s-|7j7J;4j>?Sz*2m9t7lI*zS bfk&bi;% z)hrvqUudPp^^@3`zDklP($g4(5K`Sj`xF9Z#YPMR@SPJ>^Wu#=O`p7`)8l6pOPAu6CnxsE z3Y8UE-L34<9#`%flQr0{OINZZyvdSxOg2lNw?`Q1325-R#sjvemdt88TEZ@tHb*kf zRJ3N&b;}U72NcU5-0yU|%OTfe0lxNeQ4CeKno6T9C8cllO1qDA97w~7vX~iwjAS$? zJI-4tr@526Im`Jw{?f}msD!pdR|mi+?X<^9UCKtn>WEe`>l6+jB+WT^O@=yWI^PeF>u| zKOV diff --git a/controllers/main.py b/controllers/main.py index c0682e0..ac4fe92 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -1,8 +1,8 @@ # Copyright 2021 Le Filament () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import http from odoo.http import request +from odoo import http, _ from odoo.addons.website_sale.controllers.main import WebsiteSale from odoo.addons.website_coupon.controllers.main import WebsiteCoupon @@ -22,34 +22,9 @@ class WebsiteCoupon(WebsiteCoupon): class WebsiteSale(WebsiteSale): - @http.route(['/shop/cart/update_json'], type='json', auth="public", methods=['POST'], website=True, csrf=False) - def cart_update_json(self, product_id, line_id=None, add_qty=None, set_qty=None, display=True): - res = super(WebsiteSale, self).cart_update_json(product_id, line_id, add_qty, set_qty, display) - return res - - @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False) - def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): - res = super(WebsiteSale, self).cart_update(product_id, add_qty, set_qty, **kw) - return res - # """This route is called when adding a product to cart (no options).""" - # sale_order = request.website.sale_get_order(force_create=True) - # if sale_order.state != 'draft': - # request.session['sale_order_id'] = None - # sale_order = request.website.sale_get_order(force_create=True) - # - # product_custom_attribute_values = None - # if kw.get('product_custom_attribute_values'): - # product_custom_attribute_values = json.loads(kw.get('product_custom_attribute_values')) - # - # no_variant_attribute_values = None - # if kw.get('no_variant_attribute_values'): - # no_variant_attribute_values = json.loads(kw.get('no_variant_attribute_values')) - # - # sale_order._cart_update( - # product_id=int(product_id), - # add_qty=add_qty, - # set_qty=set_qty, - # product_custom_attribute_values=product_custom_attribute_values, - # no_variant_attribute_values=no_variant_attribute_values - # ) - # return request.redirect("/shop/cart") \ No newline at end of file + @http.route(['/shop/checkout'], type='http', auth="public", website=True, sitemap=False) + def checkout(self, **post): + order = request.website.sale_get_order() + if order.amount_total <= request.website.amount_limit: + return request.redirect('/shop/cart') + return super(WebsiteSale, self).checkout(**post) diff --git a/models/__pycache__/__init__.cpython-37.pyc b/models/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index d6bdf9acaa440179cb560a14ce285d0330310bbe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmXwzv1-FW42JJ)hm=rHUHt-HapQBIUwNuxO znW77cK>zXVEo^)=wAaa5=guk!q& znvnu_>f6^1;&6AkZ3U{Gfu{BWob7B-9ctr90odLKfaP$Q9#-5Ooq5gp7R3)9akdeRG?Ong6VErF^ZMxMfS~>U`B=PY2>F#?7ON1PpogazB$0(CreK9B zS!pPv1$j$kDd{&NDU`eFD`mB;F3Gz7gZ*SpQ*)(2%a9u5BFJj4+7^8!r$@l_lox@4&RHz7jZV@ zwa>b*&_j!%EvmXI%3{u*ubWimxie)?Gq?O7q~mv9*q~6fvwWFz^FQi)bT2oyFZXJ^ L%AbY2_(S>^JQl9l diff --git a/models/__pycache__/website.cpython-37.pyc b/models/__pycache__/website.cpython-37.pyc deleted file mode 100644 index 173f3ad4ac12f84f0e2d39616a97550f0b76d7ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 507 zcmYLGJx|0i3{9JU>2$}$gc!P^GEl*c(1`&iZb1mC3{hx;$f;>cl7e7`9|9wPgPDmj zD-(Z#38&W+mh8ObS@yGYJey4r*vIEK{fZI#_LsFq0OsIk7Xm{pXpju5K!#N)afJhP zide|-3u2gu%jg+bF^kSo5&u9wDzHm#1aFveiBya?#$not+H-5e0OsIk3j#+~z)%&k zpu#+Qjam2>R0+dSF>>i8zc#{hmp-h()6SV{Ep2TsMJr@4^G@|T@2D|c=d=eTxa6%} z6sgMyX{qFdxCtR3rf)o+5^~qmW@IuV+FP!L)gg#+@kyhobyF%;-&)cLDeODaGvJ2s zdsSXQCsQt=FH?P~m{LR7KPc3pP^+`tQ#8Bv8Q$3a~SL-Q9darxb@D(Tp vH~tT@Ac}{VMUlA3_ZcK=zdh{}TzuviJmmZ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import api, fields, models - - -class ProductTempleate(models.Model): - _inherit = "product.template" - - is_coupon = fields.Boolean('Est une artilce type coupon') \ No newline at end of file diff --git a/views/product_views.xml b/views/product_views.xml deleted file mode 100755 index c0e994b..0000000 --- a/views/product_views.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - product.template.product.coupon.form - product.template - - -
-
- -
-
-
-
- -
\ No newline at end of file diff --git a/views/template.xml b/views/template.xml index 4e8bd57..8284bbb 100755 --- a/views/template.xml +++ b/views/template.xml @@ -2,18 +2,6 @@ - - \ No newline at end of file