@ -0,0 +1,16 @@ |
|||||
|
========================= |
||||
|
Product Category Code v10 |
||||
|
========================= |
||||
|
This module allows you to add a code for the product category. We can search the category by code. |
||||
|
Also we can search in products, No need to specify the category name for search, we can search by code too. |
||||
|
search will check the category name as well as category code. it make more easy in search. |
||||
|
|
||||
|
Features |
||||
|
======== |
||||
|
* Allows to add code in Product Category. |
||||
|
* Search by code in Product Category. |
||||
|
* Category search in products make more easy. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
Nikhil Krishnan @ cybrosys, nikhil@cybrosys.in |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nikhil krishnan(nikhil@cybrosys.in) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
import models |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
{ |
||||
|
'name': 'Product Category Code', |
||||
|
'version': '10.0.1.0', |
||||
|
'summary': """We Can Search/Find Product & Category by Product Category CODE.""", |
||||
|
'description': """We can search and find product and category by product category code.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'website': 'http://www.cybrosys.com', |
||||
|
'category': 'Sales Management', |
||||
|
'depends': ['product'], |
||||
|
'license': 'LGPL-3', |
||||
|
'data': ['views/product_category_code.xml'], |
||||
|
'demo': [], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nikhil krishnan(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
import product_category |
||||
|
|
@ -0,0 +1,64 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
from odoo import models, fields, api |
||||
|
from odoo.osv import expression |
||||
|
|
||||
|
|
||||
|
class ProductCategoryCode(models.Model): |
||||
|
_inherit = 'product.category' |
||||
|
|
||||
|
_sql_constraints = [('category_code_unique', 'unique (category_code)', 'The code must be unique')] |
||||
|
|
||||
|
category_code = fields.Char(string='Code', copy=False) |
||||
|
|
||||
|
@api.model |
||||
|
def name_search(self, name, args=None, operator='ilike', limit=100): |
||||
|
if not args: |
||||
|
args = [] |
||||
|
if name: |
||||
|
# Be sure name_search is symetric to name_get |
||||
|
category_names = name.split(' / ') |
||||
|
parents = list(category_names) |
||||
|
child = parents.pop() |
||||
|
domain = ['|', ('name', operator, child), ('category_code', operator, child)] |
||||
|
if parents: |
||||
|
names_ids = self.name_search(' / '.join(parents), args=args, operator='ilike', limit=limit) |
||||
|
category_ids = [name_id[0] for name_id in names_ids] |
||||
|
if operator in expression.NEGATIVE_TERM_OPERATORS: |
||||
|
categories = self.search([('id', 'not in', category_ids)]) |
||||
|
domain = expression.OR([[('parent_id', 'in', categories.ids)], domain]) |
||||
|
else: |
||||
|
domain = expression.AND([[('parent_id', 'in', category_ids)], domain]) |
||||
|
for i in range(1, len(category_names)): |
||||
|
domain = [[('name', operator, ' / '.join(category_names[-1 - i:]))], domain] |
||||
|
if operator in expression.NEGATIVE_TERM_OPERATORS: |
||||
|
domain = expression.AND(domain) |
||||
|
else: |
||||
|
domain = expression.OR(domain) |
||||
|
categories = self.search(expression.AND([domain, args]), limit=limit) |
||||
|
else: |
||||
|
categories = self.search(args, limit=limit) |
||||
|
return categories.name_get() |
||||
|
|
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 200 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,98 @@ |
|||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<h2 class="oe_slogan">Product Category Code</h2> |
||||
|
<h3 class="oe_slogan">Provide Code for Product Category, Search by code in category and product.</h3> |
||||
|
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
||||
|
</div> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h4><p style="margin-left: 42px;">Major Features:</p></h4> |
||||
|
<ul> |
||||
|
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Allows to add code in Product Category.</li> |
||||
|
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Search by code in Product Category.</li> |
||||
|
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Category search in products make more easy.</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<p><h1>Code in product category.</h1> </p> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="code.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span12"> |
||||
|
<p class="oe_mt32"> |
||||
|
<p>This module allows you to add a code for the product category.</p> |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<p class="oe_mt32"> |
||||
|
<p><h1>As shown here, we can search the category by code.</h1> </p> |
||||
|
</p> |
||||
|
</div> |
||||
|
<div class="oe_span12"> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="search in category.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<p>Get the result.</p> |
||||
|
<div class="oe_span12"> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="category search result.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<p><h1>Search in product list by category</h1> </p> |
||||
|
<div class="oe_span12"> |
||||
|
<div class="oe_demo oe_picture oe_screenshot"> |
||||
|
<img src="code in product search.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="oe_span12"> |
||||
|
<p class="oe_mt32"> |
||||
|
No need to specify the category name for search, we can search by code too. |
||||
|
search will check the category name as well as category code. |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
||||
|
<div class="oe_slogan" style="margin-top:10px !important;"> |
||||
|
<div> |
||||
|
<a class="btn btn-primary btn-lg mt8" |
||||
|
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i |
||||
|
class="fa fa-envelope"></i> Email </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
||||
|
href="https://www.cybrosys.com/contact/"><i |
||||
|
class="fa fa-phone"></i> Contact Us </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
||||
|
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i |
||||
|
class="fa fa-check-square"></i> Request Customization </a> |
||||
|
</div> |
||||
|
<br> |
||||
|
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
||||
|
<div> |
||||
|
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
||||
|
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
||||
|
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
After Width: | Height: | Size: 60 KiB |
@ -0,0 +1,38 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data> |
||||
|
<record id="product_category_code_search_view" model="ir.ui.view"> |
||||
|
<field name="name">product.category.code.search</field> |
||||
|
<field name="model">product.category</field> |
||||
|
<field name="inherit_id" ref="product.product_category_search_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='parent_id']" position="after"> |
||||
|
<field name="category_code"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="product_category_code_form_view" model="ir.ui.view"> |
||||
|
<field name="name">product.category.code.form</field> |
||||
|
<field name="model">product.category</field> |
||||
|
<field name="inherit_id" ref="product.product_category_form_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='type']" position="after"> |
||||
|
<field name="category_code"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="product_category_code_tree_view" model="ir.ui.view"> |
||||
|
<field name="name">product.category.list</field> |
||||
|
<field name="model">product.category</field> |
||||
|
<field name="priority">1</field> |
||||
|
<field name="inherit_id" ref="product.product_category_list_view" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='display_name']" position="after"> |
||||
|
<field name="category_code"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |