diff --git a/mass_price_update/README.rst b/mass_price_update/README.rst new file mode 100755 index 000000000..def1324d1 --- /dev/null +++ b/mass_price_update/README.rst @@ -0,0 +1,41 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://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. + +Configuration +============= +Add the users to the new security group 'Update Product Price' to give access to the new menu. + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: Abhishek E T @cybrosys, 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..f896d5ff8 --- /dev/null +++ b/mass_price_update/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Abhishek E T (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..1cfe74503 --- /dev/null +++ b/mass_price_update/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Abhishek E T (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': '15.0.1.0.0', + 'category': 'Inventory/Inventory', + 'summary': 'Update the sales price and the cost of any product', + 'description': 'Update the sales price and the cost of any product', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.png'], + 'website': 'https://www.cybrosys.com', + 'depends': ['product', 'stock'], + 'data': [ + 'security/mass_price_update_groups.xml', + 'security/ir.model.access.csv', + 'wizard/mass_price_update_views.xml' + ], + '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..069632731 --- /dev/null +++ b/mass_price_update/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 23.11.2022 +#### Version 15.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..138af8ae6 --- /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_user,mass.price.update,model_mass_price_update,mass_price_update.mass_price_update_group_admin,1,1,1,1 +access_change_price_line_user,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..053058053 --- /dev/null +++ b/mass_price_update/security/mass_price_update_groups.xml @@ -0,0 +1,15 @@ + + + + + Mass Price Update + Helps to manage access to the mass price update wizard + + + + Administrator + Access to the mass price update wizard menu + + + + \ No newline at end of file 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/logo.png b/mass_price_update/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/mass_price_update/static/description/assets/icons/logo.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/modules/budget_image.png b/mass_price_update/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/mass_price_update/static/description/assets/modules/budget_image.png differ diff --git a/mass_price_update/static/description/assets/modules/credit_image.png b/mass_price_update/static/description/assets/modules/credit_image.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/mass_price_update/static/description/assets/modules/credit_image.png differ diff --git a/mass_price_update/static/description/assets/modules/employee_image.png b/mass_price_update/static/description/assets/modules/employee_image.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/employee_image.png differ diff --git a/mass_price_update/static/description/assets/modules/export_image.png b/mass_price_update/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..492980ad0 Binary files /dev/null and b/mass_price_update/static/description/assets/modules/export_image.png differ diff --git a/mass_price_update/static/description/assets/modules/gantt_image.png b/mass_price_update/static/description/assets/modules/gantt_image.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/mass_price_update/static/description/assets/modules/gantt_image.png differ diff --git a/mass_price_update/static/description/assets/modules/quotation_image.png b/mass_price_update/static/description/assets/modules/quotation_image.png new file mode 100644 index 000000000..499b1a72f Binary files /dev/null and b/mass_price_update/static/description/assets/modules/quotation_image.png differ diff --git a/mass_price_update/static/description/assets/screenshots/hero.png b/mass_price_update/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..7aa696eb7 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/hero.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_1.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_1.png new file mode 100644 index 000000000..46d3e282a Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_1.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_2.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_2.png new file mode 100644 index 000000000..6ee16686d Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_2.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_3.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_3.png new file mode 100644 index 000000000..fa2a02cca Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_3.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_4.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_4.png new file mode 100644 index 000000000..46a24c9b9 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_4.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_5.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_5.png new file mode 100644 index 000000000..addf0b1d8 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_5.png differ diff --git a/mass_price_update/static/description/assets/screenshots/mass_price_update_6.png b/mass_price_update/static/description/assets/screenshots/mass_price_update_6.png new file mode 100644 index 000000000..bf33bb769 Binary files /dev/null and b/mass_price_update/static/description/assets/screenshots/mass_price_update_6.png 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..97958dece 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..03ee5bcfb 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..de6908616 --- /dev/null +++ b/mass_price_update/static/description/index.html @@ -0,0 +1,532 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+ +
+
+
+

+ Mass Price Update +

+

+ This module allows to update the sales price and the cost of the products +

+ +
+
+ + + +
+
+

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

+
+
+ +
+
+

+ Configuration +

+
+
+

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

+ +
+
+ +
+
+

+ Features +

+
+
+
+ +
+
+

+ New wizard

+

+ Use the new wizard for updating the cost/price of the products. +

+
+
+
+
+ +
+
+

+ Hassle-free operation

+

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

+
+
+
+ +
+
+

+ Screenshots +

+
+
+

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

+ +
+
+ + +
+
+

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?

+
+
+
+ + +
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/mass_price_update/wizard/__init__.py b/mass_price_update/wizard/__init__.py new file mode 100755 index 000000000..7257e7ca3 --- /dev/null +++ b/mass_price_update/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Abhishek E T (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 mass_price_update 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..cd52114d1 --- /dev/null +++ b/mass_price_update/wizard/mass_price_update.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# Author: Abhishek E T (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): + _name = 'mass.price.update' + _description = "Change Price and Cost of Products by Percentage" + + name = fields.Char(string='Name', default='Change in Product Price') + apply_to = fields.Selection([ + ('all', 'All Products'), ('category', 'Selected Categories'), + ('selected', 'Selected Products')], default='selected', + string='Apply To', required=True) + apply_on = fields.Selection([ + ('price', 'Price'), ('cost', 'Cost')], default='price', + string='Apply On', required=True) + change = fields.Float(string='Change') + apply_type = fields.Selection([ + ('add', 'Add'), ('reduce', 'Reduce')], default='add', + string='Apply Type', required=True) + product_ids = fields.Many2many( + 'product.product', string='Products', default=False, + domain="[('active', '=', True)]") + category_ids = fields.Many2many( + 'product.category', string='Categories', default=False) + line_ids = fields.One2many('change.price.line', 'mass_price_update_id', + string='Lines', readonly=True) + + @api.onchange('apply_to') + def _onchange_apply_to(self): + 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): + 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): + 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 + }) + + @api.onchange('apply_on') + def _onchange_apply_on(self): + if self.apply_on == 'cost': + self.name = 'Change in Product Cost' + else: + self.name = 'Change in Product Price' + + 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'}, + } + } + + +class ChangePriceLine(models.TransientModel): + _name = 'change.price.line' + _rec_name = 'product_id' + _description = "The Lines for Price and Cost Change" + + mass_price_update_id = fields.Many2one('mass.price.update', string='Number') + product_id = fields.Many2one( + 'product.product', string='Product', required=True, + domain="[('active', '=', True)]") + current_price = fields.Float(string='Current Price', digits='Product Price', + related='product_id.lst_price') + new_price = fields.Float(string='New Price', digits='Product Price', + compute='_compute_new_price_cost') + current_cost = fields.Float(string='Current Cost', digits='Product Price', + related='product_id.standard_price') + new_cost = fields.Float(string='New Cost', digits='Product Price', + compute='_compute_new_price_cost') + currency_id = fields.Many2one( + 'res.currency', string='Currency', related='product_id.currency_id') + + @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): + 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_views.xml b/mass_price_update/wizard/mass_price_update_views.xml new file mode 100755 index 000000000..18979d2f9 --- /dev/null +++ b/mass_price_update/wizard/mass_price_update_views.xml @@ -0,0 +1,79 @@ + + + + + mass.price.update.view.form + mass.price.update + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + Mass Price Update + mass.price.update + ir.actions.act_window + form + new + + + + +
\ No newline at end of file