Browse Source

[IMP] add maximum amount on share

12.0-max-amount-per-share
houssine 5 years ago
parent
commit
1ec4ed94a3
  1. 6
      easy_my_coop/models/product.py
  2. 1
      easy_my_coop/views/product_view.xml
  3. 3
      easy_my_coop_website/controllers/main.py
  4. 2
      easy_my_coop_website/static/src/js/easy_my_coop.js
  5. 2
      easy_my_coop_website/views/subscription_template.xml

6
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

1
easy_my_coop/views/product_view.xml

@ -26,6 +26,7 @@
<group name="configuration" string="Configuration">
<field name="force_min_qty"/>
<field name="minimum_quantity"/>
<field name="maximum_amount"/>
<field name="customer" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="by_company"/>
<field name="by_individual"/>

3
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:

2
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");

2
easy_my_coop_website/views/subscription_template.xml

@ -224,7 +224,7 @@
<i class="fa fa-minus"></i>
</a>
</span>
<input type="text" class="js_quantity form-control" data-min="1" name="ordered_parts" t-attf-value="#{ordered_parts or 1}"/>
<input type="number" class="js_quantity form-control" data-min="1" name="ordered_parts" t-attf-value="#{ordered_parts or 1}"/>
<span class="input-group-addon">
<a t-attf-href="#" class="mb8 float_left js_add_cart_json">
<i class="fa fa-plus"></i>

Loading…
Cancel
Save