12345678910111213141516171819202122232425262728293031 |
- # -*- coding: utf-8 -*-
- # Part of BiztechCS. See LICENSE file for full copyright and licensing details.
- from openerp import api, fields, models, _
- class product_category(models.Model):
- _inherit = 'product.public.category'
- include_in_menu = fields.Boolean(
- string="Include in Navigation Menu", help="Include in Navigation Menu")
- class website(models.Model):
- _inherit = 'website'
- def get_product_category(self):
- category_obj = self.env['product.public.category']
- category_ids = category_obj.search(
- [('parent_id', '=', False), ('include_in_menu', '!=', False)])
- if category_ids and len(category_ids) > 5:
- category_ids = category_ids[:5]
- elif category_ids and len(category_ids) <= 5:
- category_ids = category_ids
- return category_ids
- def get_product_child_category(self, child_id):
- category_obj = self.env['product.public.category']
- category_ids = category_obj.search(
- [('parent_id', '=', child_id), ('include_in_menu', '!=', False)], order="sequence asc")
- return category_ids
|