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 1c498fa..16bd31d 100644 Binary files a/controllers/__pycache__/main.cpython-37.pyc and b/controllers/__pycache__/main.cpython-37.pyc differ 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 d6bdf9a..0000000 Binary files a/models/__pycache__/__init__.cpython-37.pyc and /dev/null differ diff --git a/models/__pycache__/res_config_settings.cpython-37.pyc b/models/__pycache__/res_config_settings.cpython-37.pyc deleted file mode 100644 index 0014610..0000000 Binary files a/models/__pycache__/res_config_settings.cpython-37.pyc and /dev/null differ diff --git a/models/__pycache__/website.cpython-37.pyc b/models/__pycache__/website.cpython-37.pyc deleted file mode 100644 index 173f3ad..0000000 Binary files a/models/__pycache__/website.cpython-37.pyc and /dev/null differ diff --git a/models/product.py b/models/product.py deleted file mode 100755 index dc72c56..0000000 --- a/models/product.py +++ /dev/null @@ -1,10 +0,0 @@ -# © 2021 Le Filament () -# 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