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 c72acb8..1c498fa 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 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 @@ -