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.

20 lines
1.0 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. by_company = fields.Boolean(string="Can be subscribed by companies?")
  11. by_individual = fields.Boolean(string="Can be subscribed by individuals?")
  12. @api.multi
  13. def get_web_share_products(self, is_company):
  14. if is_company == True:
  15. ids = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_company','=',True)])
  16. else:
  17. ids = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_individual','=',True)])
  18. return ids