Compare commits

...

3 Commits

  1. 6
      easy_my_coop/models/product.py
  2. 1
      easy_my_coop/views/product_view.xml
  3. 6
      easy_my_coop_website/controllers/main.py
  4. 0
      easy_my_coop_website/static/src/js/easy_my_coop.js
  5. 0
      easy_my_coop_website/static/src/js/jquery.inputmask.bundle.js
  6. 6
      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"/>

6
easy_my_coop_website/controllers/main.py

@ -302,14 +302,18 @@ class WebsiteSubscription(http.Controller):
methods=['POST'], website=True)
def get_share_product(self, share_product_id, **kw):
product_template = request.env['product.template']
if share_product_id:
product = product_template.sudo().browse(int(share_product_id))
return {
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:
return False
@http.route(['/subscription/subscribe_share'],
type='http',

0
easy_my_coop/static/src/js/easy_my_coop.js → easy_my_coop_website/static/src/js/easy_my_coop.js

0
easy_my_coop/static/src/js/jquery.inputmask.bundle.js → easy_my_coop_website/static/src/js/jquery.inputmask.bundle.js

6
easy_my_coop_website/views/subscription_template.xml

@ -2,8 +2,8 @@
<odoo>
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Coop">
<xpath expr="." position="inside">
<script type="text/javascript" src="/easy_my_coop/static/src/js/easy_my_coop.js"></script>
<script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
<script type="text/javascript" src="/easy_my_coop_website/static/src/js/easy_my_coop.js"></script>
<script type="text/javascript" src="/easy_my_coop_website/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath>
</template>
@ -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