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.

32 lines
1.5 KiB

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