You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.8 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019 Coop IT Easy SCRL fs
  3. # Houssine Bakkali <houssine@coopiteasy.be>
  4. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  5. from odoo import api, fields, models
  6. class ProductTemplate(models.Model):
  7. _inherit = 'product.template'
  8. is_share = fields.Boolean(string="Is share?")
  9. short_name = fields.Char(string="Short name")
  10. display_on_website = fields.Boolean(string="Display on website")
  11. default_share_product = fields.Boolean(string="Default share product")
  12. minimum_quantity = fields.Integer(string="Minimum quantity",
  13. default=1)
  14. maximum_amount = fields.Float(string="Maximum amount per share")
  15. force_min_qty = fields.Boolean(String="Force minimum quantity?")
  16. by_company = fields.Boolean(string="Can be subscribed by companies?")
  17. by_individual = fields.Boolean(string="Can be subscribed by individuals?")
  18. customer = fields.Boolean(string="Become customer")
  19. mail_template = fields.Many2one("mail.template",
  20. string="Mail template")
  21. @api.multi
  22. def get_web_share_products(self, is_company):
  23. if is_company is True:
  24. product_templates = self.env['product.template'].search([
  25. ('is_share', '=', True),
  26. ('display_on_website', '=', True),
  27. ('by_company', '=', True)])
  28. else:
  29. product_templates = self.env['product.template'].search([
  30. ('is_share', '=', True),
  31. ('display_on_website', '=', True),
  32. ('by_individual', '=', True)])
  33. return product_templates