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.

24 lines
1.2 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 == True:
  17. product_templates = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_company','=',True)])
  18. else:
  19. product_templates = self.env['product.template'].search([('is_share','=',True), ('display_on_website','=',True),('by_individual','=',True)])
  20. return product_templates