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.

41 lines
1.6 KiB

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