diff --git a/website_product_publish/README.rst b/website_product_publish/README.rst new file mode 100644 index 000000000..a46e1146b --- /dev/null +++ b/website_product_publish/README.rst @@ -0,0 +1,46 @@ +.. 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 + +License +------- +Affero General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: (V16) Ayana KP, +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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/website_product_publish/__init__.py b/website_product_publish/__init__.py new file mode 100644 index 000000000..7aa359732 --- /dev/null +++ b/website_product_publish/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +from . import models +from . import wizard diff --git a/website_product_publish/__manifest__.py b/website_product_publish/__manifest__.py new file mode 100644 index 000000000..27b1fb43c --- /dev/null +++ b/website_product_publish/__manifest__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +{ + 'name': 'Quick Product Publish/Unpublish', + 'version': '16.0.1.0.0', + 'category': 'Website,eCommerce', + 'summary': """Quick Product Publish & Unpublish 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', + ], + 'assets': { + 'web.assets_backend': [ + 'website_product_publish/static/src/js/quick_publish_button.js', + 'website_product_publish/static/src/xml/quick_publish_button_template.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/website_product_publish/doc/RELEASE_NOTES.md b/website_product_publish/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..e60e591be --- /dev/null +++ b/website_product_publish/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 19.11.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial Commit for Quick Product Publish/Unpublish diff --git a/website_product_publish/models/__init__.py b/website_product_publish/models/__init__.py new file mode 100644 index 000000000..99c8e43e6 --- /dev/null +++ b/website_product_publish/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +from . import product_category +from . import product_template diff --git a/website_product_publish/models/product_category.py b/website_product_publish/models/product_category.py new file mode 100644 index 000000000..0bf946c04 --- /dev/null +++ b/website_product_publish/models/product_category.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +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_count', + help='Total count of published product ' + 'in website') + unpublished_count = fields.Integer(string="Unpublished", + compute='_compute_count', + help='Total count of unpublished ' + 'product in website') + + def _compute_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)]) + rec.published_count = len(products.filtered(lambda + product: product.is_published == True and product.sale_ok == True)) + rec.unpublished_count = len(products.filtered(lambda + product: product.is_published == False and product.sale_ok == True)) + + def action_publish_all_products(self): + """Smart tab function to publish products in website""" + for rec in self: + for product in self.env['product.template'].search( + [('categ_id', '=', rec.id)]).filtered( + lambda product: product.sale_ok == True): + if not product.is_published: + product.is_published = True + + def action_nothing(self): + """ return true """ + return True diff --git a/website_product_publish/models/product_template.py b/website_product_publish/models/product_template.py new file mode 100644 index 000000000..5ed9f1874 --- /dev/null +++ b/website_product_publish/models/product_template.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +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_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') + }, + } diff --git a/website_product_publish/security/ir.model.access.csv b/website_product_publish/security/ir.model.access.csv new file mode 100644 index 000000000..32c93d957 --- /dev/null +++ b/website_product_publish/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_product_publish_user,access.product.publish.user,model_product_publish,base.group_user,1,1,1,1 diff --git a/website_product_publish/static/description/assets/icons/check.png b/website_product_publish/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/website_product_publish/static/description/assets/icons/check.png differ diff --git a/website_product_publish/static/description/assets/icons/chevron.png b/website_product_publish/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/chevron.png differ diff --git a/website_product_publish/static/description/assets/icons/cogs.png b/website_product_publish/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/cogs.png differ diff --git a/website_product_publish/static/description/assets/icons/consultation.png b/website_product_publish/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/website_product_publish/static/description/assets/icons/consultation.png differ diff --git a/website_product_publish/static/description/assets/icons/ecom-black.png b/website_product_publish/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/ecom-black.png differ diff --git a/website_product_publish/static/description/assets/icons/education-black.png b/website_product_publish/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/website_product_publish/static/description/assets/icons/education-black.png differ diff --git a/website_product_publish/static/description/assets/icons/hotel-black.png b/website_product_publish/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/website_product_publish/static/description/assets/icons/hotel-black.png differ diff --git a/website_product_publish/static/description/assets/icons/license.png b/website_product_publish/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/website_product_publish/static/description/assets/icons/license.png differ diff --git a/website_product_publish/static/description/assets/icons/lifebuoy.png b/website_product_publish/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/website_product_publish/static/description/assets/icons/lifebuoy.png differ diff --git a/website_product_publish/static/description/assets/icons/logo.png b/website_product_publish/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/website_product_publish/static/description/assets/icons/logo.png differ diff --git a/website_product_publish/static/description/assets/icons/manufacturing-black.png b/website_product_publish/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/website_product_publish/static/description/assets/icons/manufacturing-black.png differ diff --git a/website_product_publish/static/description/assets/icons/pos-black.png b/website_product_publish/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/pos-black.png differ diff --git a/website_product_publish/static/description/assets/icons/puzzle.png b/website_product_publish/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/puzzle.png differ diff --git a/website_product_publish/static/description/assets/icons/restaurant-black.png b/website_product_publish/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/restaurant-black.png differ diff --git a/website_product_publish/static/description/assets/icons/service-black.png b/website_product_publish/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/website_product_publish/static/description/assets/icons/service-black.png differ diff --git a/website_product_publish/static/description/assets/icons/trading-black.png b/website_product_publish/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/website_product_publish/static/description/assets/icons/trading-black.png differ diff --git a/website_product_publish/static/description/assets/icons/training.png b/website_product_publish/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/website_product_publish/static/description/assets/icons/training.png differ diff --git a/website_product_publish/static/description/assets/icons/update.png b/website_product_publish/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/website_product_publish/static/description/assets/icons/update.png differ diff --git a/website_product_publish/static/description/assets/icons/user.png b/website_product_publish/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/website_product_publish/static/description/assets/icons/user.png differ diff --git a/website_product_publish/static/description/assets/icons/wrench.png b/website_product_publish/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/website_product_publish/static/description/assets/icons/wrench.png differ diff --git a/website_product_publish/static/description/assets/modules/module_image (1).png b/website_product_publish/static/description/assets/modules/module_image (1).png new file mode 100644 index 000000000..ed175b076 Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image (1).png differ diff --git a/website_product_publish/static/description/assets/modules/module_image (2).png b/website_product_publish/static/description/assets/modules/module_image (2).png new file mode 100644 index 000000000..75f0877e6 Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image (2).png differ diff --git a/website_product_publish/static/description/assets/modules/module_image _(2).png b/website_product_publish/static/description/assets/modules/module_image _(2).png new file mode 100644 index 000000000..0ce773650 Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image _(2).png differ diff --git a/website_product_publish/static/description/assets/modules/module_image.jpeg b/website_product_publish/static/description/assets/modules/module_image.jpeg new file mode 100644 index 000000000..b5be46007 Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image.jpeg differ diff --git a/website_product_publish/static/description/assets/modules/module_image.png b/website_product_publish/static/description/assets/modules/module_image.png new file mode 100644 index 000000000..1d2238b80 Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image.png differ diff --git a/website_product_publish/static/description/assets/modules/module_image_2.png b/website_product_publish/static/description/assets/modules/module_image_2.png new file mode 100644 index 000000000..df65629bf Binary files /dev/null and b/website_product_publish/static/description/assets/modules/module_image_2.png differ diff --git a/website_product_publish/static/description/assets/screenshots/hero.png b/website_product_publish/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..7a536d2dd Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/hero.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-1.png b/website_product_publish/static/description/assets/screenshots/product_publish-1.png new file mode 100644 index 000000000..dc58cf363 Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-1.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-2.png b/website_product_publish/static/description/assets/screenshots/product_publish-2.png new file mode 100644 index 000000000..a1c562800 Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-2.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-3.png b/website_product_publish/static/description/assets/screenshots/product_publish-3.png new file mode 100644 index 000000000..1ead80130 Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-3.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-4.png b/website_product_publish/static/description/assets/screenshots/product_publish-4.png new file mode 100644 index 000000000..0e0abe1da Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-4.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-5.png b/website_product_publish/static/description/assets/screenshots/product_publish-5.png new file mode 100644 index 000000000..f4dab3f79 Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-5.png differ diff --git a/website_product_publish/static/description/assets/screenshots/product_publish-6.png b/website_product_publish/static/description/assets/screenshots/product_publish-6.png new file mode 100644 index 000000000..37e8f1d8a Binary files /dev/null and b/website_product_publish/static/description/assets/screenshots/product_publish-6.png differ diff --git a/website_product_publish/static/description/banner.png b/website_product_publish/static/description/banner.png new file mode 100644 index 000000000..45afa2b89 Binary files /dev/null and b/website_product_publish/static/description/banner.png differ diff --git a/website_product_publish/static/description/icon.png b/website_product_publish/static/description/icon.png new file mode 100644 index 000000000..4f4cd57e0 Binary files /dev/null and b/website_product_publish/static/description/icon.png differ diff --git a/website_product_publish/static/description/index.html b/website_product_publish/static/description/index.html new file mode 100644 index 000000000..d384c822f --- /dev/null +++ b/website_product_publish/static/description/index.html @@ -0,0 +1,627 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+
+
+

+ Quick Product Publish/Unpublish

+

+ This Module Helps to Publish/Unpublish Product from Website Shop + Without Redirecting to Website. +

+ +
+
+ +
+
+

+ Overview +

+
+
+

+ This module helps you to publish/unpublish products without + redirecting to the website. It also provides an option to + publish/unpublish multiple products from the list view and the + products can be published category wise. The count of published + and unpublished products in each category is also shown.

+
+
+
+
+

+ Features +

+
+
+
+ +
+
+

+ Multiple Product Publish/Unpublish From List View

+
+
+
+
+ +
+
+

+ Category Wise Publish/Unpublish

+
+
+
+
+ +
+
+

+ Quick Product Publish/Unpublish Without Redirecting to + Website

+
+
+
+
+ +
+
+

+ Published/Unpublished Product Count in Category

+
+
+
+
+
+

+ Screenshots +

+
+
+

+ Quick Publish button in the product form

+ +
+
+

+ Quick Unpublish button in the product form

+ +
+
+

+ Publish/Unpublish All Products button in the product category

+ +
+
+

+ Total count of the Published and Unpublished products in the + selected category

+ +
+
+

+ Multiple product Publish/Unpublish from the list view

+ +
+
+

+ Wizard for selecting Publish or Unpublish product from website shop

+ +
+
+ +
+
+

Suggested Products

+
+ +
+
+ + +
+
+
+

Our Services

+
+
+
+
+ +
+
+ Odoo + Customization
+
+
+
+ +
+
+ Odoo + Implementation
+
+
+
+ +
+
+ Odoo + Support
+
+
+
+ +
+
+ Hire + Odoo + Developer
+
+
+
+ +
+
+ Odoo + Integration
+
+
+
+ +
+
+ Odoo + Migration
+
+
+
+ +
+
+ Odoo + Consultancy
+
+
+
+ +
+
+ Odoo + Implementation
+
+
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + +
+
+
+

Our Industries

+
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + +
+
+
+

Need Help?

+
+
+
+ +
+
+
+ +
+ WhatsApp +
+
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
\ No newline at end of file diff --git a/website_product_publish/static/src/js/quick_publish_button.js b/website_product_publish/static/src/js/quick_publish_button.js new file mode 100644 index 000000000..857a8cd52 --- /dev/null +++ b/website_product_publish/static/src/js/quick_publish_button.js @@ -0,0 +1,25 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { standardFieldProps } from "@web/views/fields/standard_field_props"; +const { Component, useState } = owl; +// Creating a new button widget for 'Quick Publish' which works same as the +//current publish button widget. +class QuickWebsitePublishButton extends Component{ + setup(){ + this.trueColor = "green" + this.falseColor = "red" + } + updateValue(){ + this.props.update(!this.props.value) + } +} +QuickWebsitePublishButton.template = "QuickWebsitePublishButton" +QuickWebsitePublishButton.props = { + ...standardFieldProps, + options: { type: Object, optional: true } +} +QuickWebsitePublishButton.supportedTypes = ["boolean"] +QuickWebsitePublishButton.extractProps = ({attrs}) => { + return {options: attrs.options} +} +registry.category("fields").add("quick_publish_button", QuickWebsitePublishButton) diff --git a/website_product_publish/static/src/xml/quick_publish_button_template.xml b/website_product_publish/static/src/xml/quick_publish_button_template.xml new file mode 100644 index 000000000..3ebd4d76b --- /dev/null +++ b/website_product_publish/static/src/xml/quick_publish_button_template.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/website_product_publish/views/product_category_views.xml b/website_product_publish/views/product_category_views.xml new file mode 100644 index 000000000..a32a335a1 --- /dev/null +++ b/website_product_publish/views/product_category_views.xml @@ -0,0 +1,33 @@ + + + + + + product.category.view.form.inherit.website.product.publish + + product.category + + + + + + + + + diff --git a/website_product_publish/views/product_template_views.xml b/website_product_publish/views/product_template_views.xml new file mode 100644 index 000000000..c51719c8f --- /dev/null +++ b/website_product_publish/views/product_template_views.xml @@ -0,0 +1,16 @@ + + + + + + product.template.view.form.inherit.website.product.publish + + product.template + + + + quick_publish_button + + + + diff --git a/website_product_publish/wizard/__init__.py b/website_product_publish/wizard/__init__.py new file mode 100644 index 000000000..b9653d672 --- /dev/null +++ b/website_product_publish/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +from . import product_publish diff --git a/website_product_publish/wizard/product_publish.py b/website_product_publish/wizard/product_publish.py new file mode 100644 index 000000000..381007a1d --- /dev/null +++ b/website_product_publish/wizard/product_publish.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Ayana K 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 . +# +############################################################################### +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 diff --git a/website_product_publish/wizard/product_publish_views.xml b/website_product_publish/wizard/product_publish_views.xml new file mode 100644 index 000000000..5087d11e4 --- /dev/null +++ b/website_product_publish/wizard/product_publish_views.xml @@ -0,0 +1,33 @@ + + + + + product.publish.view.form + product.publish + +
+

The selected products will be published/unpublished + from website +

+
+
+
+
+
+ + + Publish/Unpublish + + + code + action = records.action_publish() + +