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.

37 lines
1.7 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", default=1)
  13. force_min_qty = fields.Boolean(String="Force minimum quantity?")
  14. by_company = fields.Boolean(string="Can be subscribed by companies?")
  15. by_individual = fields.Boolean(string="Can be subscribed by individuals?")
  16. customer = fields.Boolean(string="Become customer")
  17. mail_template = fields.Many2one('mail.template',
  18. string="Mail template")
  19. @api.multi
  20. def get_web_share_products(self, is_company):
  21. if is_company is True:
  22. product_templates = self.env['product.template'].search([
  23. ('is_share', '=', True),
  24. ('display_on_website', '=', True),
  25. ('by_company', '=', True)])
  26. else:
  27. product_templates = self.env['product.template'].search([
  28. ('is_share', '=', True),
  29. ('display_on_website', '=', True),
  30. ('by_individual', '=', True)])
  31. return product_templates