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.

30 lines
1.4 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. @api.multi
  15. def get_web_share_products(self, is_company):
  16. if is_company is True:
  17. product_templates = self.env['product.template'].search([
  18. ('is_share', '=', True),
  19. ('display_on_website', '=', True),
  20. ('by_company', '=', True)])
  21. else:
  22. product_templates = self.env['product.template'].search([
  23. ('is_share', '=', True),
  24. ('display_on_website', '=', True),
  25. ('by_individual', '=', True)])
  26. return product_templates