Browse Source

Jun 20 : [FIX] Bug Fixed

pull/257/head
AjmalCybro 2 years ago
parent
commit
2e11a5d55d
  1. 12
      odoo_product_tags/README.rst
  2. 6
      odoo_product_tags/__manifest__.py
  3. 6
      odoo_product_tags/doc/RELEASE_NOTES.md
  4. 2
      odoo_product_tags/models/__init__.py
  5. 58
      odoo_product_tags/models/product_product.py
  6. 39
      odoo_product_tags/models/product_tags.py
  7. 14
      odoo_product_tags/models/product_template.py
  8. 18
      odoo_product_tags/models/res_config_settings.py
  9. 1
      odoo_product_tags/security/ir.model.access.csv
  10. BIN
      odoo_product_tags/static/description/assets/modules/approval_image.png
  11. BIN
      odoo_product_tags/static/description/assets/modules/budget_image.png
  12. BIN
      odoo_product_tags/static/description/assets/modules/export_image.png
  13. BIN
      odoo_product_tags/static/description/assets/modules/magento_image.png
  14. BIN
      odoo_product_tags/static/description/assets/modules/module01.png
  15. BIN
      odoo_product_tags/static/description/assets/modules/module02.png
  16. BIN
      odoo_product_tags/static/description/assets/modules/module03.png
  17. BIN
      odoo_product_tags/static/description/assets/modules/module04.png
  18. BIN
      odoo_product_tags/static/description/assets/modules/module05.png
  19. BIN
      odoo_product_tags/static/description/assets/modules/module06.png
  20. BIN
      odoo_product_tags/static/description/assets/modules/pos_image.png
  21. BIN
      odoo_product_tags/static/description/assets/modules/shopify_image.png
  22. 124
      odoo_product_tags/static/description/index.html
  23. 15
      odoo_product_tags/views/product_product_views.xml
  24. 69
      odoo_product_tags/views/product_tags_views.xml
  25. 49
      odoo_product_tags/views/product_template_views.xml
  26. 4
      odoo_product_tags/views/res_config_settings_views.xml
  27. 26
      odoo_product_tags/wizard/wizard.py
  28. 15
      odoo_product_tags/wizard/wizard.xml

12
odoo_product_tags/README.rst

@ -1,7 +1,12 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
Odoo Product Tags
=======
* Odoo Product Tags module for Odoo 16.
Installation
============
- www.odoo.com/documentation/16.0/setup/install.html
@ -14,15 +19,16 @@ General Public License, Version 3 (LGPL v3).
Company
-------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>'__
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>'__
* Developer: Cybrosys
Contacts
--------
* Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker
-----------
@ -30,6 +36,8 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you
Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com

6
odoo_product_tags/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': "Odoo Product Tags",
'version': '16.0.1.0.0',
'version': '16.0.2.0.1',
'summary': """Odoo Product Tags""",
"category": 'Inventory',
'description': """Module helps to manage products easily using tags.""",
@ -32,8 +32,8 @@
'depends': ['base', 'sale', 'sale_management'],
'data': [
'security/ir.model.access.csv',
'views/product_tags_views.xml',
'views/product_template_views.xml',
'views/product_product_views.xml',
'views/res_config_settings_views.xml',
'wizard/wizard.xml',
],
@ -41,5 +41,5 @@
'license': "LGPL-3",
'installable': True,
'auto_install': False,
'application': True
'application': False
}

6
odoo_product_tags/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Odoo Product Tags
#### 05.04.2023
#### Version 16.0.2.0.1
#### UPDT
- Made changes to depends on odoo16's default workflow

2
odoo_product_tags/models/__init__.py

@ -21,6 +21,6 @@
#############################################################################
from . import res_config_settings
from . import product_tags
from . import product_template
from . import product_product

58
odoo_product_tags/models/product_product.py

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# 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
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import ast
from odoo import api, fields, models, _
class ProductProduct(models.Model):
_inherit = 'product.product'
@api.model
def create(self, vals):
"""Inherited for passing the product Tags."""
res = super(ProductProduct, self).create(vals)
if not res.product_tag_ids:
pro_tag = self.env['ir.config_parameter'].sudo().get_param(
'odoo_product_tags.product_tag_ids')
if pro_tag:
tag_ids = ast.literal_eval(pro_tag)
res.update({
"product_tag_ids": [(6, 0, tag_ids)],
})
return res
else:
return res
def action_apply_product_tags(self):
"""Applying product tags"""
return {
'name': 'Apply Product Tag',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'product.tags.wizard',
'context': {
'default_product_ids': self.ids,
'default_is_product': True
},
'target': 'new',
}

39
odoo_product_tags/models/product_tags.py

@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# 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
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models, _
from random import randint
class ProductTags(models.Model):
_name = "product.tags"
_description = 'Product Tags'
_rec_name = "name"
_inherit = ['mail.thread', 'mail.activity.mixin']
def _random_color(self):
return randint(1, 11)
name = fields.Char(required=1, copy=False, string='Name')
description = fields.Text(string='Description', translate=True)
tag_color = fields.Integer(string="Tag Color", default=_random_color)
product_tmpl_ids = fields.Many2many('product.template', string="Products")

14
odoo_product_tags/models/product_template.py

@ -26,27 +26,24 @@ import ast
class ProductTemplate(models.Model):
_inherit = 'product.template'
product_tags_ids = fields.Many2many(
"product.tags", string="Product Tags", help="Product Tags")
@api.model
def create(self, vals):
"""Inherited for passing the product Tags."""
res = super(ProductTemplate, self).create(vals)
if not res.product_tags_ids:
if not res.product_tag_ids:
pro_tag = self.env['ir.config_parameter'].sudo().get_param(
'odoo_product_tags.product_tags_ids')
'odoo_product_tags.product_tag_ids')
if pro_tag:
tag_ids = ast.literal_eval(pro_tag)
res.update({
"product_tags_ids": [(6, 0, tag_ids)],
"product_tag_ids": [(6, 0, tag_ids)],
})
return res
else:
return res
def action_apply_tags(self):
def action_apply_template_tags(self):
return {
'name': 'Apply Product Tag',
'type': 'ir.actions.act_window',
@ -54,7 +51,8 @@ class ProductTemplate(models.Model):
'view_mode': 'form',
'res_model': 'product.tags.wizard',
'context': {
'default_product_ids': self.ids,
'default_product_tmp_ids': self.ids,
'default_is_product_template': True
},
'target': 'new',
}

18
odoo_product_tags/models/res_config_settings.py

@ -19,34 +19,36 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models, _
from ast import literal_eval
from odoo import api, fields, models, _
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
product_tags_ids = fields.Many2many(
'product.tags', string='Default Product Tags')
product_tag_ids = fields.Many2many(
'product.tag', string='Default Product Tags')
def set_values(self):
""" save values in the settings product tag fields"""
res = super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].set_param(
'odoo_product_tags.product_tags_ids',
self.product_tags_ids.ids)
'odoo_product_tags.product_tag_ids',
self.product_tag_ids.ids)
return res
@api.model
def get_values(self):
""" Get values for product tag fields in the settings
and assign the value to that fields"""
res = super(ResConfigSettings, self).get_values()
params = self.env['ir.config_parameter'].sudo()
pro_tag_ids = params.get_param(
'odoo_product_tags.product_tags_ids')
'odoo_product_tags.product_tag_ids')
if pro_tag_ids:
res.update(
product_tags_ids=[(6, 0, literal_eval(
product_tag_ids=[(6, 0, literal_eval(
pro_tag_ids))] if pro_tag_ids else False)
return res
else:
return res

1
odoo_product_tags/security/ir.model.access.csv

@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_tags,product.tags,model_product_tags,base.group_user,1,1,1,1
access_product_tags_wizard,product.tags.wizard,model_product_tags_wizard,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
access_product_tags product.tags model_product_tags base.group_user 1 1 1 1
2 access_product_tags_wizard product.tags.wizard model_product_tags_wizard base.group_user 1 1 1 1

BIN
odoo_product_tags/static/description/assets/modules/approval_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

BIN
odoo_product_tags/static/description/assets/modules/budget_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

BIN
odoo_product_tags/static/description/assets/modules/export_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

BIN
odoo_product_tags/static/description/assets/modules/magento_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

BIN
odoo_product_tags/static/description/assets/modules/module01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
odoo_product_tags/static/description/assets/modules/module02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
odoo_product_tags/static/description/assets/modules/module03.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
odoo_product_tags/static/description/assets/modules/module04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
odoo_product_tags/static/description/assets/modules/module05.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
odoo_product_tags/static/description/assets/modules/module06.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
odoo_product_tags/static/description/assets/modules/pos_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

BIN
odoo_product_tags/static/description/assets/modules/shopify_image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

124
odoo_product_tags/static/description/index.html

@ -106,7 +106,7 @@
<div class="col-mg-12 pl-3">
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important; line-height: 30px !important;">
Odoo Product Tags module allows you to add product tags. You can assign multiple tags to a product and multiple products to a tag with a single click.</p>
Odoo Product Tags module allows you to add product tags from list view. You can assign multiple tags to a product and multiple products to a tag with a single click.</p>
</div>
</div>
@ -130,7 +130,7 @@
Mass Update</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Multiple product tags can be updated in the product template list view..</p>
Multiple product tags can be updated in the product list view..</p>
</div>
</div>
@ -172,71 +172,6 @@
<i class="fa fa-image mr-2"></i>Screenshots
</h2>
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Go to Sales -> Products -> Product Tag.</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/protag_1.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Click on "Create" button to create new product tags, here you need to select tag name, description and color.</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/protag_2.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Product Template form view with product tags.
</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/protag_3.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Product Template list view with product tags.
</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/protag_4.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Filter the products related to a tag.
</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
</p>
<img src="assets/screenshots/protag_7.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
<img src="assets/screenshots/protag_8.png" style="margin-top: 25px" class="img-responsive img-thumbnail border" width="100%"
height="auto" />
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
@ -278,7 +213,8 @@
</div>
<!-- SUGGESTED PRODUCTS -->
<!-- SUGGESTED PRODUCTS -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 2.5rem 1rem !important;">
@ -288,76 +224,74 @@
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height:0px">
<div class="carousel-inner" style="padding: 30px;">
<div class="carousel-item active" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/export_stockinfo_xls/" target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/login_user_detail/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/export_image.png">
style="border-radius: 0px;"
src="./assets/modules/module01.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/dashboard_pos/" target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/web_login_styles/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/pos_image.png">
style="border-radius: 0px;"
src="./assets/modules/module02.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/product_approval_management/"
target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/multi_branch_base/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/approval_image.png">
style="border-radius: 0px;"
src="./assets/modules/module03.png">
</div>
</a>
</div>
</div>
<div class="carousel-item" style="min-height:0px">
<div class="carousel-item active" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/base_account_budget/" target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/employee_documents_expiry/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/budget_image.png">
style="border-radius: 0px;"
src="./assets/modules/module04.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/shopify_odoo_connector/" target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/sale_report_advanced/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/shopify_image.png">
style="border-radius: 0px;"
src="./assets/modules/module05.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/odoo11_magento2/" target="_blank">
<a href="https://apps.odoo.com/apps/modules/16.0/subscription_package/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/magento_image.png">
style="border-radius: 0px;"
src="./assets/modules/module06.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span class="carousel-control-prev-icon"><i
class="fa fa-chevron-left" style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo1" data-slide="next"
style="right:-25px;width: 35px;color: #000;">
<a class="carousel-control-prev" href="#demo1" data-slide="prev" style="width:35px; color:#000"> <span
class="carousel-control-prev-icon"><i class="fa fa-chevron-left" style="font-size:24px"></i></span>
</a> <a class="carousel-control-next" href="#demo1" data-slide="next" style="width:35px; color:#000">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</a>
</div>
</div>
</div>

15
odoo_product_tags/views/product_product_views.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_product_tree_view" model="ir.ui.view">
<field name="name">product.product.view.list.inherit.odoo.product.tags</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button class="btn-primary" name="action_apply_product_tags"
type="object" string="Apply Product Tag"
/>
</xpath>
</field>
</record>
</odoo>

69
odoo_product_tags/views/product_tags_views.xml

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_tags_view_tree" model="ir.ui.view">
<field name="name">product.tags.tree</field>
<field name="model">product.tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="tag_color" widget="color_picker"/>
</tree>
</field>
</record>
<record id="product_tags_view_form" model="ir.ui.view">
<field name="name">product.tags.form</field>
<field name="model">product.tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="name"/>
</group>
<group>
<field name="tag_color" widget="color_picker"/>
</group>
</group>
<group>
<field name="product_tmpl_ids" widget="many2many_tags"/>
</group>
<group>
<field name="description"/>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<record id="action_product_tags" model="ir.actions.act_window">
<field name="name">Product Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.tags</field>
<field name="view_mode">tree,form,kanban</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create New Product Tags!
</p>
</field>
</record>
<menuitem id="sale_menu_product_tags"
name="Product Tags"
parent="sale.product_menu_catalog"
action="action_product_tags"
sequence="13"/>
</odoo>

49
odoo_product_tags/views/product_template_views.xml

@ -1,62 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="product_template_tag_form_view">
<field name="name">product.template.product.tags</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_policy']" position="after">
<field name="product_tags_ids"
widget="many2many_tags"
options="{'color_field': 'tag_color', 'no_create_edit': True}"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="product_template_tag_tree_view">
<field name="name">product.template.product.tags</field>
<record id="product_template_tree_view" model="ir.ui.view">
<field name="name">product.template.view.list.inherit.odoo.product.tags</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="inside">
<header>
<button class="btn-primary" name="action_apply_tags"
<xpath expr="//header" position="inside">
<button class="btn-primary" name="action_apply_template_tags"
type="object" string="Apply Product Tag"
/>
</header>
</xpath>
<xpath expr="//field[@name='default_code']" position="after">
<field name="product_tags_ids"
widget="many2many_tags"
options="{'color_field': 'tag_color', 'no_create_edit': True}"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="product_template_tag_kanban_view">
<field name="name">product.template.product.tags</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='product_lst_price']" position="before">
<field name="product_tags_ids"
widget="many2many_tags"
options="{'color_field': 'tag_color', 'no_create_edit': True}"/>
</xpath>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="name">product.template.search.inherit.odoo.product.tags</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='services']" position="after">
<filter name="product_tags" string="Product Tags"
context="{'group_by': 'product_tags_ids'}"/>
<filter name="product_tags" string="Product Tags" context="{'group_by': 'product_tag_ids'}"/>
</xpath>
</field>
</record>
</odoo>

4
odoo_product_tags/views/res_config_settings_views.xml

@ -11,8 +11,8 @@
<div class="o_setting_right_pane">
<span class="o_form_label">Product Tags</span>
<div class="row mt16" >
<label for="product_tags_ids" class="col-lg-4 o_light_label"/>
<field name="product_tags_ids" widget="many2many_tags" class="oe_inline"/>
<label for="product_tag_ids" class="col-lg-4 o_light_label"/>
<field name="product_tag_ids" widget="many2many_tags" class="oe_inline"/>
</div>
</div>
</div>

26
odoo_product_tags/wizard/wizard.py

@ -20,25 +20,37 @@
#
#############################################################################
from odoo import api, fields, models, _
import datetime
class ProductTagsWizard(models.TransientModel):
_name = 'product.tags.wizard'
_description = 'Product Tags Wizard'
product_tags_ids = fields.Many2many(
"product.tags", string="Product Tags", help="Product Tags")
is_product = fields.Boolean('Is Product', default=False, help='Is Product')
is_product_template = fields.Boolean('Is Product Template', default=False, help='Is Product Template')
product_tag_ids = fields.Many2many(
"product.tag", string="Product Tags", help="Product Tags")
product_ids = fields.Many2many(
'product.product', string="Products", readonly=True)
product_tmp_ids = fields.Many2many(
'product.template', string="Products", readonly=True)
def action_apply_product_tags(self):
def action_apply_template_tags(self):
"""Applying product tag to Template"""
product_id = self.env['product.template'].sudo().browse(
self.env.context.get('active_ids'))
pro_tag_ids = self.product_tags_ids.ids
pro_tag_ids = self.product_tag_ids.ids
for product in product_id:
product.update({
"product_tags_ids": [(6, 0, pro_tag_ids)],
"product_tag_ids": [(6, 0, pro_tag_ids)],
})
def action_apply_product_tags(self):
"""Applying product tag to Product"""
product_id = self.env['product.product'].sudo().browse(
self.env.context.get('active_ids'))
pro_tag_ids = self.product_tag_ids.ids
for product in product_id:
product.update({
"product_tag_ids": [(6, 0, pro_tag_ids)],
})

15
odoo_product_tags/wizard/wizard.xml

@ -8,17 +8,24 @@
<form>
<sheet>
<group>
<field name="product_ids" widget="many2many_tags"/>
<field name="is_product" invisible="1"/>
<field name="is_product_template" invisible="1"/>
<field name="product_ids" widget="many2many_tags"
attrs="{'invisible':[('is_product','=',False)]}"/>
<field name="product_tmp_ids" widget="many2many_tags"
attrs="{'invisible':[('is_product_template','=',False)]}"/>
</group>
<group>
<field name="product_tags_ids"
<field name="product_tag_ids"
widget="many2many_tags"
options="{'color_field': 'tag_color', 'no_create_edit': True}"/>
options="{'color_field': 'color', 'no_create_edit': True}"/>
</group>
</sheet>
<footer>
<button name="action_apply_product_tags" string="Apply Product Tags"
type="object" class="oe_highlight"/>
type="object" class="oe_highlight" attrs="{'invisible':[('is_product','=',False)]}"/>
<button name="action_apply_template_tags" string="Apply Product Tags"
type="object" class="oe_highlight" attrs="{'invisible':[('is_product_template','=',False)]}"/>
<button string="Cancel" class="btn btn_default"
special="cancel"/>
</footer>

Loading…
Cancel
Save