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.

31 lines
1.5 KiB

  1. from odoo import api, fields, models
  2. class ProductTemplate(models.Model):
  3. _inherit = 'product.template'
  4. is_share = fields.Boolean(string="Is share?")
  5. short_name = fields.Char(string="Short name")
  6. display_on_website = fields.Boolean(string="Display on website")
  7. default_share_product = fields.Boolean(string="Default share product")
  8. minimum_quantity = fields.Integer(string="Minimum quantity", default=1)
  9. force_min_qty = fields.Boolean(String="Force minimum quantity?")
  10. by_company = fields.Boolean(string="Can be subscribed by companies?")
  11. by_individual = fields.Boolean(string="Can be subscribed by individuals?")
  12. customer = fields.Boolean(string="Become customer")
  13. mail_template = fields.Many2one('mail.template',
  14. string="Mail template")
  15. @api.multi
  16. def get_web_share_products(self, is_company):
  17. if is_company is True:
  18. product_templates = self.env['product.template'].search([
  19. ('is_share', '=', True),
  20. ('display_on_website', '=', True),
  21. ('by_company', '=', True)])
  22. else:
  23. product_templates = self.env['product.template'].search([
  24. ('is_share', '=', True),
  25. ('display_on_website', '=', True),
  26. ('by_individual', '=', True)])
  27. return product_templates