From 1ec4ed94a36797e6ecf69e0213f4024427202c39 Mon Sep 17 00:00:00 2001 From: houssine Date: Mon, 28 Oct 2019 14:29:07 +0100 Subject: [PATCH] [IMP] add maximum amount on share --- easy_my_coop/models/product.py | 6 ++++-- easy_my_coop/views/product_view.xml | 1 + easy_my_coop_website/controllers/main.py | 3 ++- easy_my_coop_website/static/src/js/easy_my_coop.js | 2 +- easy_my_coop_website/views/subscription_template.xml | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/easy_my_coop/models/product.py b/easy_my_coop/models/product.py index 0706a1d..9617f7a 100644 --- a/easy_my_coop/models/product.py +++ b/easy_my_coop/models/product.py @@ -14,12 +14,14 @@ class ProductTemplate(models.Model): short_name = fields.Char(string="Short name") display_on_website = fields.Boolean(string="Display on website") default_share_product = fields.Boolean(string="Default share product") - minimum_quantity = fields.Integer(string="Minimum quantity", default=1) + minimum_quantity = fields.Integer(string="Minimum quantity", + default=1) + maximum_amount = fields.Float(string="Maximum amount per share") force_min_qty = fields.Boolean(String="Force minimum quantity?") by_company = fields.Boolean(string="Can be subscribed by companies?") by_individual = fields.Boolean(string="Can be subscribed by individuals?") customer = fields.Boolean(string="Become customer") - mail_template = fields.Many2one('mail.template', + mail_template = fields.Many2one("mail.template", string="Mail template") @api.multi diff --git a/easy_my_coop/views/product_view.xml b/easy_my_coop/views/product_view.xml index 9d043d2..697c9aa 100644 --- a/easy_my_coop/views/product_view.xml +++ b/easy_my_coop/views/product_view.xml @@ -26,6 +26,7 @@ + diff --git a/easy_my_coop_website/controllers/main.py b/easy_my_coop_website/controllers/main.py index bbf91b8..28d4a8e 100644 --- a/easy_my_coop_website/controllers/main.py +++ b/easy_my_coop_website/controllers/main.py @@ -308,7 +308,8 @@ class WebsiteSubscription(http.Controller): product.id: { 'list_price': product.list_price, 'min_qty': product.minimum_quantity, - 'force_min_qty': product.force_min_qty + 'force_min_qty': product.force_min_qty, + 'max_amount': product.maximum_amount } } else: diff --git a/easy_my_coop_website/static/src/js/easy_my_coop.js b/easy_my_coop_website/static/src/js/easy_my_coop.js index e87c61e..9c2d494 100644 --- a/easy_my_coop_website/static/src/js/easy_my_coop.js +++ b/easy_my_coop_website/static/src/js/easy_my_coop.js @@ -25,7 +25,7 @@ $(document).ready(function () { }); $(oe_easymy_coop).on('click', 'a.js_add_cart_json', function (ev) { - var $share_price = $('#share_price').text() + var $share_price = $('#share_price').text() var $link = $(ev.currentTarget); var $input = $link.parent().parent().find("input"); var $input_total = $("div").find(".total"); diff --git a/easy_my_coop_website/views/subscription_template.xml b/easy_my_coop_website/views/subscription_template.xml index 8ff1934..d70e943 100644 --- a/easy_my_coop_website/views/subscription_template.xml +++ b/easy_my_coop_website/views/subscription_template.xml @@ -224,7 +224,7 @@ - +