diff --git a/__manifest__.py b/__manifest__.py index d75bcc42a699d8a3bff5a7aa3c9bb67dd78b7713..69ec48650c630fc63d3e00a9f3cd37e2986e5778 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 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 c0682e08d2b1d0b60e7dc4d3034c3830ca537e6d..ac4fe92a0d7c208e1e7a6daa2abfb2f19779b94e 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -1,8 +1,8 @@ # Copyright 2021 Le Filament (<http://www.le-filament.com>) # 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 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 0014610850d374bf332de568851852643ef222df..0000000000000000000000000000000000000000 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 173f3ad4ac12f84f0e2d39616a97550f0b76d7ec..0000000000000000000000000000000000000000 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 dc72c56dca6ca214915d740be416e763548eef5a..0000000000000000000000000000000000000000 --- a/models/product.py +++ /dev/null @@ -1,10 +0,0 @@ -# © 2021 Le Filament (<http://www.le-filament.com>) -# 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 c0e994b0d1602bd8eb43f32ed62bbb096276b851..0000000000000000000000000000000000000000 --- a/views/product_views.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<odoo> - - <record model="ir.ui.view" id="product_template_form_view"> - <field name="name">product.template.product.coupon.form</field> - <field name="model">product.template</field> - <field name="inherit_id" ref="website_sale.product_template_form_view"/> - <field name="arch" type="xml"> - <div name="options" position="inside"> - <div> - <field name="is_coupon"/> - </div> - </div> - </field> - </record> - -</odoo> \ No newline at end of file diff --git a/views/template.xml b/views/template.xml index 4e8bd578ad7f569d96278adfebed5bc07d02ae67..8284bbbe260484aa7966bba04a9d852333a353e2 100755 --- a/views/template.xml +++ b/views/template.xml @@ -2,18 +2,6 @@ <odoo> <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"> @@ -24,12 +12,4 @@ </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> - </odoo> \ No newline at end of file