@ -0,0 +1,45 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Quick Product Publish/Unpublish |
|||
=============================== |
|||
This module helps to publish/unpublish product from website shop. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V18) Manasa T P, Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.co |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
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 `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import models |
|||
from . import wizard |
|||
from . import tests |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Quick Product Publish/Unpublish', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Website,eCommerce', |
|||
'summary': """Quick Product Publish & Un publish on |
|||
Website Shop""", |
|||
'description': """This module helps to quick product |
|||
publish/Unpublish |
|||
on website shop,Also helps in multi product |
|||
publish/unpublish and |
|||
category vise publish/unpublish""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['web', 'website_sale'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/product_template_views.xml', |
|||
'views/product_category_views.xml', |
|||
'wizard/product_publish_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <website_product_publish> |
|||
|
|||
#### 21.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial Commit for Quick Product Publish/Unpublish |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import product_category |
|||
from . import product_template |
@ -0,0 +1,66 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class ProductCategory(models.Model): |
|||
""" Inheriting product category to add fields for publish |
|||
product in website """ |
|||
_inherit = 'product.category' |
|||
|
|||
published_count = fields.Integer(string="Published", |
|||
compute='_compute_published_count', |
|||
help='Total count of published product ' |
|||
'in website.') |
|||
unpublished_count = fields.Integer(string="Unpublished", |
|||
compute='_compute_published_count', |
|||
help='Total count of unpublished ' |
|||
'product in website.') |
|||
|
|||
def _compute_published_count(self): |
|||
"""Function for computing count of published and unpublished products""" |
|||
for rec in self: |
|||
products = self.env['product.template'].search( |
|||
[('categ_id', '=', rec.id)]) |
|||
published = products.filtered(lambda product: |
|||
product.is_published == True |
|||
and product.sale_ok == True) |
|||
unpublished = products.filtered(lambda product: |
|||
product.is_published == False |
|||
and product.sale_ok == True) |
|||
rec.published_count = len(published) |
|||
rec.unpublished_count = len(unpublished) |
|||
|
|||
def action_publish_all_products(self): |
|||
"""Smart tab function to publish products in website""" |
|||
for rec in self: |
|||
products = self.env['product.template'].search( |
|||
[('categ_id', '=', rec.id)]) |
|||
products = products.filtered(lambda product: |
|||
product.sale_ok == True) |
|||
for product in products: |
|||
if not product.is_published: |
|||
product.is_published = True |
|||
|
|||
def action_nothing(self): |
|||
""" Return true """ |
|||
return True |
@ -0,0 +1,62 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import models |
|||
|
|||
|
|||
class ProductTemplate(models.Model): |
|||
""" Inheriting product template to add fields for publish |
|||
product in website """ |
|||
_inherit = 'product.template' |
|||
|
|||
def quick_publish_products(self): |
|||
""" Function for publish product in website shop """ |
|||
for rec in self: |
|||
rec.is_published = True if not rec.is_published else False |
|||
return { |
|||
'type': 'ir.actions.client', |
|||
'tag': 'reload', |
|||
} |
|||
|
|||
def action_published(self): |
|||
"""Function on button to publish the product""" |
|||
self.is_published = True |
|||
|
|||
def action_unpublished(self): |
|||
"""Function on button to un publish the product""" |
|||
self.is_published = False |
|||
|
|||
def action_publish(self): |
|||
""" Open a wizard for publish or un publish products |
|||
based on the selected products.""" |
|||
return { |
|||
'name': "Publish/Unpublish products", |
|||
'type': 'ir.actions.act_window', |
|||
'view_type': 'form', |
|||
'view_mode': 'form', |
|||
'res_model': 'product.publish', |
|||
'view_id': self.env.ref( |
|||
'website_product_publish.product_publish_view_form').id, |
|||
'target': 'new', |
|||
'context': { |
|||
'default_product_ids': self.env.context.get('active_ids') |
|||
}, |
|||
} |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 751 KiB |
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import test_product_category |
|||
from . import test_product_template |
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
import logging |
|||
from odoo.tests import common |
|||
|
|||
_LOGGER = logging.getLogger(__name__) |
|||
|
|||
|
|||
class TestProductCategory(common.TransactionCase): |
|||
|
|||
@classmethod |
|||
def setUpClass(cls): |
|||
super(TestProductCategory, cls).setUpClass() |
|||
cls.count_01 = cls.env['product.category'].create({ |
|||
'name': "New category", |
|||
}) |
|||
cls.products_02 = cls.env['product.category'].create( |
|||
{'name': 'Veg'}) |
|||
cls.count_02 = cls.env['product.template'].create({'name': 'vegproduct', |
|||
'categ_id': |
|||
cls.products_02.id, |
|||
}) |
|||
|
|||
def test_action_publish_all_products(self): |
|||
self.products_02.action_publish_all_products() |
|||
value = self.count_02.is_published |
|||
message = "Product is published" |
|||
self.assertTrue(value, message) |
@ -0,0 +1,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
import logging |
|||
from odoo.tests import common |
|||
_LOGGER = logging.getLogger(__name__) |
|||
|
|||
|
|||
class TestProductTemplate(common.TransactionCase): |
|||
@classmethod |
|||
def setUpClass(cls): |
|||
super(TestProductTemplate, cls).setUpClass() |
|||
# create a template |
|||
cls.product_template = cls.env['product.template'].create({ |
|||
'name': 'Test Product', |
|||
'is_published': True, |
|||
'list_price': 750, |
|||
}) |
|||
|
|||
def test_action_published(self): |
|||
self.product_template.action_published() |
|||
self.assertTrue(self.product_template.is_published) |
|||
|
|||
def test_action_unpublished(self): |
|||
self.product_template.action_unpublished() |
|||
self.assertFalse(self.product_template.is_published) |
|||
|
|||
def test_quick_publish_products(self): |
|||
self.product_template.quick_publish_products() |
|||
self.assertFalse(self.product_template.is_published) |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Adding button in product category for website publish --> |
|||
<record id="product_category_form_view" model="ir.ui.view"> |
|||
<field name="name"> |
|||
product.category.view.form.inherit.website.product.publish |
|||
</field> |
|||
<field name="model">product.category</field> |
|||
<field name="inherit_id" ref="product.product_category_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@name='button_box']" position="inside"> |
|||
<button name="action_publish_all_products" type="object" |
|||
class="oe_stat_button" icon="fa-globe" |
|||
string="Publish All Products" |
|||
sequence="10"> |
|||
</button> |
|||
<button style="width: 200px;" name="action_nothing" |
|||
type="object"> |
|||
<div class="o_field_widget o_stat_info"> |
|||
<span class="o_stat_value" style="margin-left: 5px;"> |
|||
Published: |
|||
<field name="published_count"/> |
|||
</span> |
|||
<span class="o_stat_value" style="margin-left: 5px;"> |
|||
Unpublished : |
|||
<field name="unpublished_count"/> |
|||
</span> |
|||
</div> |
|||
</button> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Adding button in product template for website publish --> |
|||
<record id="product_template_form_view" model="ir.ui.view"> |
|||
<field name="name"> |
|||
product.template.view.form.inherit.website.product.publish |
|||
</field> |
|||
<field name="model">product.template</field> |
|||
<field name="inherit_id" ref="website_sale.product_template_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='is_published']" position="after"> |
|||
<button name="action_published" type="object" |
|||
string="Publish" invisible="is_published ==True" |
|||
sequence="10"> |
|||
<i class="fa fa-fw o_button_icon fa-globe text-success" |
|||
title="publish"/> |
|||
<div class="o_stat_info"> |
|||
<span class="o_stat_text">Publish</span> |
|||
</div> |
|||
</button> |
|||
<button name="action_unpublished" type="object" |
|||
invisible="is_published ==False" |
|||
sequence="10"> |
|||
<i class="fa fa-fw o_button_icon fa-globe text-danger" |
|||
title="unpublish"/> |
|||
<div class="o_stat_info"> |
|||
<span class="o_stat_text">Unpublish</span> |
|||
</div> |
|||
</button> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import product_publish |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Manasa T P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import models |
|||
|
|||
|
|||
class ProductPublish(models.TransientModel): |
|||
""" Wizard for multiple product publish in product template """ |
|||
_name = 'product.publish' |
|||
_description = "Product Publish/Unpublish" |
|||
|
|||
def action_product_multi_publish(self): |
|||
""" Function for publishing products on a website """ |
|||
active_ids = self._context.get('active_ids') |
|||
products = self.env['product.template'].browse(active_ids) |
|||
products = products.filtered(lambda product: product.sale_ok == True) |
|||
for product in products: |
|||
product.is_published = True |
|||
|
|||
def action_product_multi_unpublish(self): |
|||
""" Function for un publish product in website""" |
|||
active_ids = self._context.get('active_ids') |
|||
products = self.env['product.template'].browse(active_ids) |
|||
products = products.filtered(lambda product: product.sale_ok == True) |
|||
for product in products: |
|||
product.is_published = False |