diff --git a/mass_price_update/README.rst b/mass_price_update/README.rst new file mode 100755 index 000000000..11671ec7e --- /dev/null +++ b/mass_price_update/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 + +Mass Price Update +================= +This module allow to update the price/cost of products by percentage. + +Configuration +============= +Add the users to the new security group 'Update Product Price' to give access to the new menu. + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (V14) Ammu Raj, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +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/mass_price_update/__init__.py b/mass_price_update/__init__.py new file mode 100644 index 000000000..66f3a254a --- /dev/null +++ b/mass_price_update/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ammu Raj (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 wizard diff --git a/mass_price_update/__manifest__.py b/mass_price_update/__manifest__.py new file mode 100644 index 000000000..f66ad4995 --- /dev/null +++ b/mass_price_update/__manifest__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ammu Raj (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': 'Mass Price Update', + 'version': '14.0.1.0.0', + 'category': 'Warehouse', + 'summary': 'Update the sales price and the cost of any product by' + 'percentage', + 'description': 'This module allows to update more than one products sales' + 'and cost price by single click', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['stock'], + 'data': [ + 'security/mass_price_update_groups.xml', + 'security/ir.model.access.csv', + 'wizard/mass_price_update_views.xml' + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/mass_price_update/doc/RELEASE_NOTES.md b/mass_price_update/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..58f2b708c --- /dev/null +++ b/mass_price_update/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 25.10.2022 +#### Version 14.0.1.0.0 +#### ADD + +- Initial commit for Mass Price Update diff --git a/mass_price_update/security/ir.model.access.csv b/mass_price_update/security/ir.model.access.csv new file mode 100644 index 000000000..d59182049 --- /dev/null +++ b/mass_price_update/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mass_price_update,access.mass.price.update,model_mass_price_update,mass_price_update.mass_price_update_group_admin,1,1,1,1 +access_change_price_line,access.change.price.line,model_change_price_line,mass_price_update.mass_price_update_group_admin,1,1,1,1 diff --git a/mass_price_update/security/mass_price_update_groups.xml b/mass_price_update/security/mass_price_update_groups.xml new file mode 100644 index 000000000..b5dc3a7be --- /dev/null +++ b/mass_price_update/security/mass_price_update_groups.xml @@ -0,0 +1,18 @@ + + + + + Mass Price Update + Helps to manage access to the mass price + update wizard + + + + + Administrator + Access to the mass price update wizard menu + + + + diff --git a/mass_price_update/static/description/assets/icons/check.png b/mass_price_update/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/mass_price_update/static/description/assets/icons/check.png differ diff --git a/mass_price_update/static/description/assets/icons/chevron.png b/mass_price_update/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/chevron.png differ diff --git a/mass_price_update/static/description/assets/icons/cogs.png b/mass_price_update/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/cogs.png differ diff --git a/mass_price_update/static/description/assets/icons/consultation.png b/mass_price_update/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/mass_price_update/static/description/assets/icons/consultation.png differ diff --git a/mass_price_update/static/description/assets/icons/ecom-black.png b/mass_price_update/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/ecom-black.png differ diff --git a/mass_price_update/static/description/assets/icons/education-black.png b/mass_price_update/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/mass_price_update/static/description/assets/icons/education-black.png differ diff --git a/mass_price_update/static/description/assets/icons/hotel-black.png b/mass_price_update/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/mass_price_update/static/description/assets/icons/hotel-black.png differ diff --git a/mass_price_update/static/description/assets/icons/license.png b/mass_price_update/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/mass_price_update/static/description/assets/icons/license.png differ diff --git a/mass_price_update/static/description/assets/icons/lifebuoy.png b/mass_price_update/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/mass_price_update/static/description/assets/icons/lifebuoy.png differ diff --git a/mass_price_update/static/description/assets/icons/manufacturing-black.png b/mass_price_update/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/mass_price_update/static/description/assets/icons/manufacturing-black.png differ diff --git a/mass_price_update/static/description/assets/icons/pos-black.png b/mass_price_update/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/pos-black.png differ diff --git a/mass_price_update/static/description/assets/icons/puzzle.png b/mass_price_update/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/puzzle.png differ diff --git a/mass_price_update/static/description/assets/icons/restaurant-black.png b/mass_price_update/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/restaurant-black.png differ diff --git a/mass_price_update/static/description/assets/icons/service-black.png b/mass_price_update/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/mass_price_update/static/description/assets/icons/service-black.png differ diff --git a/mass_price_update/static/description/assets/icons/trading-black.png b/mass_price_update/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/mass_price_update/static/description/assets/icons/trading-black.png differ diff --git a/mass_price_update/static/description/assets/icons/training.png b/mass_price_update/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/mass_price_update/static/description/assets/icons/training.png differ diff --git a/mass_price_update/static/description/assets/icons/update.png b/mass_price_update/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/mass_price_update/static/description/assets/icons/update.png differ diff --git a/mass_price_update/static/description/assets/icons/user.png b/mass_price_update/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/mass_price_update/static/description/assets/icons/user.png differ diff --git a/mass_price_update/static/description/assets/icons/wrench.png b/mass_price_update/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/mass_price_update/static/description/assets/icons/wrench.png differ diff --git a/mass_price_update/static/description/assets/misc/categories.png b/mass_price_update/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/categories.png differ diff --git a/mass_price_update/static/description/assets/misc/check-box.png b/mass_price_update/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/check-box.png differ diff --git a/mass_price_update/static/description/assets/misc/compass.png b/mass_price_update/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/mass_price_update/static/description/assets/misc/compass.png differ diff --git a/mass_price_update/static/description/assets/misc/corporate.png b/mass_price_update/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/mass_price_update/static/description/assets/misc/corporate.png differ diff --git a/mass_price_update/static/description/assets/misc/customer-support.png b/mass_price_update/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/mass_price_update/static/description/assets/misc/customer-support.png differ diff --git a/mass_price_update/static/description/assets/misc/cybrosys-logo.png b/mass_price_update/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/mass_price_update/static/description/assets/misc/cybrosys-logo.png differ diff --git a/mass_price_update/static/description/assets/misc/features.png b/mass_price_update/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/features.png differ diff --git a/mass_price_update/static/description/assets/misc/logo.png b/mass_price_update/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/mass_price_update/static/description/assets/misc/logo.png differ diff --git a/mass_price_update/static/description/assets/misc/pictures.png b/mass_price_update/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/pictures.png differ diff --git a/mass_price_update/static/description/assets/misc/pie-chart.png b/mass_price_update/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/pie-chart.png differ diff --git a/mass_price_update/static/description/assets/misc/right-arrow.png b/mass_price_update/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/right-arrow.png differ diff --git a/mass_price_update/static/description/assets/misc/star.png b/mass_price_update/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/mass_price_update/static/description/assets/misc/star.png differ diff --git a/mass_price_update/static/description/assets/misc/support.png b/mass_price_update/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/support.png differ diff --git a/mass_price_update/static/description/assets/misc/whatsapp.png b/mass_price_update/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/mass_price_update/static/description/assets/misc/whatsapp.png differ diff --git a/mass_price_update/static/description/assets/modules/1.png b/mass_price_update/static/description/assets/modules/1.png new file mode 100644 index 000000000..5365b9593 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/1.png differ diff --git a/mass_price_update/static/description/assets/modules/2.png b/mass_price_update/static/description/assets/modules/2.png new file mode 100644 index 000000000..87a76bd25 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/2.png differ diff --git a/mass_price_update/static/description/assets/modules/3.png b/mass_price_update/static/description/assets/modules/3.png new file mode 100644 index 000000000..4e4ea0e51 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/3.png differ diff --git a/mass_price_update/static/description/assets/modules/4.png b/mass_price_update/static/description/assets/modules/4.png new file mode 100644 index 000000000..5365b9593 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/4.png differ diff --git a/mass_price_update/static/description/assets/modules/5.png b/mass_price_update/static/description/assets/modules/5.png new file mode 100644 index 000000000..cb335eb14 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/5.png differ diff --git a/mass_price_update/static/description/assets/modules/6.png b/mass_price_update/static/description/assets/modules/6.png new file mode 100644 index 000000000..48303274f Binary files /dev/null and b/mass_price_update/static/description/assets/modules/6.png differ diff --git a/mass_price_update/static/description/assets/screenshots/1.png b/mass_price_update/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..f7558dc02 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/1.png differ diff --git a/mass_price_update/static/description/assets/screenshots/2.png b/mass_price_update/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..a813a76df Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/2.png differ diff --git a/mass_price_update/static/description/assets/screenshots/3.png b/mass_price_update/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..5bb9e3e9d Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/3.png differ diff --git a/mass_price_update/static/description/assets/screenshots/4.png b/mass_price_update/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..113fab898 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/4.png differ diff --git a/mass_price_update/static/description/assets/screenshots/5.png b/mass_price_update/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..592ab814a Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/5.png differ diff --git a/mass_price_update/static/description/assets/screenshots/6.png b/mass_price_update/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..7fbbd8aa5 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/6.png differ diff --git a/mass_price_update/static/description/assets/screenshots/hero.gif b/mass_price_update/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..38a1594e9 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/hero.gif differ diff --git a/mass_price_update/static/description/banner.png b/mass_price_update/static/description/banner.png new file mode 100644 index 000000000..326defb01 Binary files /dev/null and b/mass_price_update/static/description/banner.png differ diff --git a/mass_price_update/static/description/icon.png b/mass_price_update/static/description/icon.png new file mode 100644 index 000000000..31ecd0522 Binary files /dev/null and b/mass_price_update/static/description/icon.png differ diff --git a/mass_price_update/static/description/index.html b/mass_price_update/static/description/index.html new file mode 100644 index 000000000..78023bb0a --- /dev/null +++ b/mass_price_update/static/description/index.html @@ -0,0 +1,616 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.Sh +
+
+
+ +
+
+
+ +

+ Mass Price Update

+

+ This Module Allows to Update the Sales Price and the Cost of the Products by percentage.

+ + +
+
+
+
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module crafted by Cybrosys Technologies provides an option to modify the sale price and cost + of the products from a wizard. It helps to reduce the manual effort and time since we don't have + to update them one by one from the product form by add or deduct the price by percentage. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Use the new wizard for updating the cost/price of the products. + +
+
+
+
+ + View and confirm the current and new cost/price of the products before changing it. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

Configuration

+

Add the users to the new security group(Mass Price Update: Administrator) to give access to the new menu.

+ +
+
+

New menu

+

Use the new menu Inventory -> Products -> Mass Price Update to open the wizard.

+ +
+
+

Different options to select the products

+

    +
  1. Select all products
  2. +
  3. Select the categories
  4. +
  5. Select the required products
  6. +
+ The selected products will be listed in the tree view in the wizard.

+ +
+
+

More fields to make it simple

+

The Apply on field is used to select either Price or Cost to update the sales price and cost of + the selected products. Set the percentage to be changed in the Change field. On the Apply type, + select add to add the amount and reduce to reduce the amount. + The current and new price/cost of the selected products will be updated asap in the list view.

+ +
+
+

An extra step for safety

+

An extra confirmation to avoid updating the sale price or cost of products by accidentally + clicking the change button in the wizard.

+ +
+
+

Notification

+

Notification on completing the price update.

+ +
+
+
+ + + +
+
+ +
+

Related + 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

+
+
+
+
+ + + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/mass_price_update/wizard/__init__.py b/mass_price_update/wizard/__init__.py new file mode 100755 index 000000000..5e946cdab --- /dev/null +++ b/mass_price_update/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ammu Raj (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 change_price_line +from . import mass_price_update diff --git a/mass_price_update/wizard/change_price_line.py b/mass_price_update/wizard/change_price_line.py new file mode 100644 index 000000000..9825f5422 --- /dev/null +++ b/mass_price_update/wizard/change_price_line.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ammu Raj (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 api, fields, models + + +class ChangePriceLine(models.TransientModel): + """One2many for align the products with new price""" + _name = 'change.price.line' + _rec_name = 'product_id' + _description = "Change Price Line" + + mass_price_update_id = fields.Many2one('mass.price.update', string='Number', + help='The related field from mass' + 'price update') + product_id = fields.Many2one( + 'product.product', string='Product', required=True, + domain="[('active', '=', True)]", help='Selected products will show') + current_price = fields.Float(string='Current Price', digits='Product Price', + related='product_id.lst_price', + help='The current Sales price') + new_price = fields.Float(string='New Price', digits='Product Price', + compute='_compute_new_price_cost', + help='Computing the new price based on the percentage') + current_cost = fields.Float(string='Current Cost', digits='Product Price', + related='product_id.standard_price', + help='Current cost of the product') + new_cost = fields.Float(string='New Cost', digits='Product Price', + compute='_compute_new_price_cost', + help='Computing the new cost based on the' + 'percentage') + currency_id = fields.Many2one('res.currency', string='Currency', + related='product_id.currency_id', + help='The currency of the product') + + @api.depends('mass_price_update_id.apply_on', + 'mass_price_update_id.change', + 'mass_price_update_id.apply_type') + def _compute_new_price_cost(self): + """Compute new price and new cost""" + for record in self: + if record.mass_price_update_id.apply_type == 'add': + percentage_num = 1 + record.mass_price_update_id.change + else: + percentage_num = 1 - record.mass_price_update_id.change + if record.mass_price_update_id.apply_on == 'price': + record.new_cost = False + record.new_price = record.current_price * percentage_num + else: + record.new_price = False + record.new_cost = record.current_cost * percentage_num diff --git a/mass_price_update/wizard/mass_price_update.py b/mass_price_update/wizard/mass_price_update.py new file mode 100755 index 000000000..3ef29d313 --- /dev/null +++ b/mass_price_update/wizard/mass_price_update.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ammu Raj (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 api, fields, models, _ +from odoo.exceptions import UserError + + +class MassPriceUpdate(models.TransientModel): + """Change Price and Cost of Products by Percentage""" + _name = 'mass.price.update' + _description = "Mass Price Update" + + apply_to = fields.Selection([ + ('all', 'All Products'), ('category', 'Selected Categories'), + ('selected', 'Selected Products')], default='selected', + string='Apply To', required=True, + help='Allows to select the products based on the conditions') + apply_on = fields.Selection([ + ('price', 'Price'), ('cost', 'Cost')], default='price', + string='Apply On', required=True, help='Apply on Price or Cost') + change = fields.Float(string='Change', + help='The percentage for adding or reducing to the actual price') + apply_type = fields.Selection([ + ('add', 'Add'), ('reduce', 'Reduce')], default='add', + string='Apply Type', required=True, + help='Choose the applying type whether add or reduce') + product_ids = fields.Many2many( + 'product.product', string='Products', default=False, + domain="[('active', '=', True)]", help='Choose the required products') + category_ids = fields.Many2many( + 'product.category', string='Categories', default=False, + help='Choose the required Categories') + line_ids = fields.One2many('change.price.line', 'mass_price_update_id', + string='Lines', readonly=True, + help='The selected product with updated price') + + @api.onchange('apply_to') + def _onchange_apply_to(self): + """When select an option from apply_to, the related records will show""" + if self.apply_to == 'all': + self.write({ + 'category_ids': [(5,)], + 'line_ids': [(5,)], + 'product_ids': [(6, 0, self.env['product.product'].search( + [('active', '=', True)]).ids)] + }) + elif self.apply_to == 'category': + self.write({ + 'line_ids': [(5,)], + 'product_ids': [(6, 0, self.env['product.product'].search( + [('categ_id', 'in', self.category_ids.ids)]).ids)] + }) + else: + self.write({ + 'product_ids': [(5,)], + 'category_ids': [(5,)], + 'line_ids': [(5,)] + }) + + @api.onchange('product_ids') + def _onchange_product_ids(self): + """Updating the products in lines""" + if self.product_ids: + self.write({'line_ids': [(5,)]}) + lines = [] + for product in self.product_ids: + lines.append((0, 0, {'product_id': product._origin.id})) + self.write({'line_ids': lines}) + + @api.onchange('category_ids') + def _onchange_category_ids(self): + """When select the category related product will show""" + if self.category_ids: + self.write({'line_ids': [(5,)], 'product_ids': [(5,)]}) + lines = [] + products = self.env['product.product'].sudo().search( + [('categ_id', 'in', self.category_ids.ids)]) + for product in products: + lines.append((0, 0, {'product_id': product.id})) + self.write({ + 'product_ids': products.ids, + 'line_ids': lines + }) + + def action_change_price(self): + """This function is used to change the price or cost of products""" + if self.apply_to == 'category' and not self.product_ids: + raise UserError(_("Please select any category with products.")) + if self.apply_to == 'selected' and not self.product_ids: + raise UserError(_("Please select any product.")) + if not self.change: + raise UserError(_("Please enter the change in percentage.")) + if self.apply_type == 'add': + percentage_num = 1 + self.change + else: + percentage_num = 1 - self.change + if self.apply_on == 'price': + for product in self.product_ids: + product.lst_price = product.lst_price * percentage_num + else: + for product in self.product_ids: + product_template = product.product_tmpl_id + product_template.standard_price = ( + product_template.standard_price * percentage_num) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _('Success'), + 'message': _( + f"""The {'sales price' if self.apply_on == 'price' + else 'cost'} is updated."""), + 'sticky': True, + 'next': {'type': 'ir.actions.act_window_close'}, + } + } diff --git a/mass_price_update/wizard/mass_price_update_views.xml b/mass_price_update/wizard/mass_price_update_views.xml new file mode 100755 index 000000000..41e738798 --- /dev/null +++ b/mass_price_update/wizard/mass_price_update_views.xml @@ -0,0 +1,81 @@ + + + + + mass.price.update.view.form + mass.price.update + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + Mass Price Update + mass.price.update + ir.actions.act_window + form + new + + + +