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.

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