diff --git a/scrap_management/README.rst b/scrap_management/README.rst new file mode 100644 index 000000000..b5e33287d --- /dev/null +++ b/scrap_management/README.rst @@ -0,0 +1,48 @@ +.. 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 + +Automated Scrap Order +===================== +Manage your scrap products automatically based on their expiration date. + +Configuration +------------- + - www.odoo.com/documentation/16.0/setup/install.html + - Install our custom addon + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License v3.0 (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer : (V16) Shafna K, 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: ``__ \ No newline at end of file diff --git a/scrap_management/__init__.py b/scrap_management/__init__.py new file mode 100644 index 000000000..9e4996d07 --- /dev/null +++ b/scrap_management/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 controllers +from . import models +from . import report +from . import wizard diff --git a/scrap_management/__manifest__.py b/scrap_management/__manifest__.py new file mode 100644 index 000000000..94560fc41 --- /dev/null +++ b/scrap_management/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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': "Automated Scrap Order", + 'version': '16.0.1.0.0', + 'category': 'Warehouse', + 'summary': 'To manage scrap orders automatically based on expiry.', + 'description': "This module automates the creation of scrap orders based" + "on product expiry dates and generates a report for" + " tracking and managing the disposal of expired products" + "which moved to the scrap.", + 'author': " Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['stock', 'product_expiry'], + 'data': [ + 'security/ir.model.access.csv', + 'data/ir_cron_data.xml', + 'views/res_config_settings_views.xml', + 'views/stock_lot_views.xml', + 'report/scrap_management_reports.xml', + 'report/scrap_management_templates.xml', + 'wizard/scrap_report_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'scrap_management/static/src/js/scrap_management.js' + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/scrap_management/controllers/__init__.py b/scrap_management/controllers/__init__.py new file mode 100644 index 000000000..9898dd162 --- /dev/null +++ b/scrap_management/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 scrap_management diff --git a/scrap_management/controllers/scrap_management.py b/scrap_management/controllers/scrap_management.py new file mode 100644 index 000000000..e0034d0f2 --- /dev/null +++ b/scrap_management/controllers/scrap_management.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 . +# +############################################################################### +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.tools import html_escape + + +class ScrapManagementXLSVReport(http.Controller): + """To create the route for xlsx report""" + @http.route('/report_xlsx', type='http', auth='user', methods=['POST'], + csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name): + """To generate the response""" + report_obj = request.env[model].with_user(request.session.uid) + options = json.loads(options) + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', + content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = http.serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/scrap_management/data/ir_cron_data.xml b/scrap_management/data/ir_cron_data.xml new file mode 100644 index 000000000..0a8599464 --- /dev/null +++ b/scrap_management/data/ir_cron_data.xml @@ -0,0 +1,16 @@ + + + + + + Scrap Management + + code + model.action_scrap_order() + + 1 + days + -1 + + + \ No newline at end of file diff --git a/scrap_management/doc/RELEASE_NOTES.md b/scrap_management/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..9922a57fa --- /dev/null +++ b/scrap_management/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 30.11.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial Commit for Automated Scrap Order diff --git a/scrap_management/models/__init__.py b/scrap_management/models/__init__.py new file mode 100644 index 000000000..e568ed633 --- /dev/null +++ b/scrap_management/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 res_config_settings +from . import stock_lot diff --git a/scrap_management/models/res_config_settings.py b/scrap_management/models/res_config_settings.py new file mode 100644 index 000000000..8b69573b1 --- /dev/null +++ b/scrap_management/models/res_config_settings.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 fields, models + + +class ResConfigSettings(models.TransientModel): + """This contains the fields added in configuration settings""" + _inherit = "res.config.settings" + + move_to_scrap = fields.Boolean( + string="Move To Scrap", store=True, + config_parameter='scrap_management.move_to_scrap', + help="Product will move to scrap after expiry") + move_to_scrap_days = fields.Integer( + string="After", config_parameter='scrap_management.move_to_scrap_days', + store=True, help="Move to scrap after these days") diff --git a/scrap_management/models/stock_lot.py b/scrap_management/models/stock_lot.py new file mode 100644 index 000000000..80d1017eb --- /dev/null +++ b/scrap_management/models/stock_lot.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 . +# +############################################################################### +import datetime +from odoo import api, fields, models + + +class StockLot(models.Model): + """To add fields in stock lot and compute move date""" + _inherit = "stock.lot" + + move_date = fields.Datetime(string="Move Date", + help="Date which product need to be moved to " + "scrap", compute='_compute_move_date') + move_scrap = fields.Boolean(string="Move To Scrap", + help="Enable to automatically move product to " + "scrap based on expiry date", + compute='_compute_move_scrap') + + @api.depends('product_id', 'expiration_date', 'move_scrap') + def _compute_move_date(self): + """Compute function to calculate the date of moving to scrap based on + expiration date and days given in configuration settings""" + self.move_date = False + for rec in self: + if rec.product_id.use_expiration_date: + move_days = self.env['ir.config_parameter'].sudo().get_param( + 'scrap_management.move_to_scrap_days') + if not rec.product_id.use_expiration_date and not \ + rec.move_scrap and rec.product_qty <= 0: + rec.move_date = False + elif rec.expiration_date and rec.move_scrap and \ + rec.product_qty > 0: + rec.move_date = rec.expiration_date + datetime.timedelta( + days=int(move_days)) + + def _compute_move_scrap(self): + """Compute function to get the value of boolean field whether move to + scrap based on expiration date or not""" + for rec in self: + rec.move_scrap = rec.env['ir.config_parameter'].sudo().get_param( + 'scrap_management.move_to_scrap') + + def action_scrap_order(self): + """To create a scrap order automatically when product is expired""" + today_start = fields.Date.start_of(fields.Datetime.today(), 'day') + today_end = fields.Date.end_of(fields.Datetime.today(), 'day') + for rec in self.env['stock.lot'].search([]): + if rec.expiration_date and rec.move_date: + expiry_date = rec.filtered( + lambda date: today_start <= date.move_date <= today_end) + for recs in expiry_date: + self.env['stock.scrap'].create({ + 'product_id': recs.product_id.id, + 'lot_id': recs.id, + 'scrap_qty': recs.product_qty, + }) diff --git a/scrap_management/report/__init__.py b/scrap_management/report/__init__.py new file mode 100644 index 000000000..8b8b335d6 --- /dev/null +++ b/scrap_management/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna (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 scrap_management_reports diff --git a/scrap_management/report/scrap_management_reports.py b/scrap_management/report/scrap_management_reports.py new file mode 100644 index 000000000..8b0e49936 --- /dev/null +++ b/scrap_management/report/scrap_management_reports.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna (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, models + + +class ScrapManagementReport(models.AbstractModel): + """To generate report based on query and get report values""" + _name = "report.scrap_management.report_scrap_order" + + @api.model + def _get_report_values(self, docids, data=None): + """ To get the report values based on the user giving conditions""" + value = self.query_data(data['from_date'], data['to_date'], + data['product_id']) + return { + 'var': value + } + + def query_data(self, from_date, to_date, product_id): + """ To fetch values from database using query""" + query = """select product_template.name as product, + stock_scrap.scrap_qty as quantity,DATE(stock_scrap.date_done) as + date from stock_scrap inner join product_product on + stock_scrap.product_id = product_product.id inner join + product_template on product_template.id = + product_product.product_tmpl_id where stock_scrap.state='done'""" + if product_id: + query += """ and product_template.id=%(product_id)s""" + if from_date: + query += """ and DATE(stock_scrap.date_done) >= %(from_date)s""" + if to_date: + query += """ and DATE(stock_scrap.date_done) <= %(to_date)s""" + self.env.cr.execute(query, + {'from_date': from_date, + 'to_date': to_date, + 'product_id': product_id, + }) + return self.env.cr.dictfetchall() diff --git a/scrap_management/report/scrap_management_reports.xml b/scrap_management/report/scrap_management_reports.xml new file mode 100644 index 000000000..3f217e0db --- /dev/null +++ b/scrap_management/report/scrap_management_reports.xml @@ -0,0 +1,13 @@ + + + + + Scrap Order Report + stock.scrap + qweb-pdf + scrap_management.report_scrap_order + scrap_management.report_scrap_order + ’Scrap Order Report - %s' + report + + \ No newline at end of file diff --git a/scrap_management/report/scrap_management_templates.xml b/scrap_management/report/scrap_management_templates.xml new file mode 100644 index 000000000..bdfa00ab8 --- /dev/null +++ b/scrap_management/report/scrap_management_templates.xml @@ -0,0 +1,48 @@ + + + + + \ No newline at end of file diff --git a/scrap_management/security/ir.model.access.csv b/scrap_management/security/ir.model.access.csv new file mode 100644 index 000000000..15f324a24 --- /dev/null +++ b/scrap_management/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_scrap_report,access.scrap.report,model_scrap_report,base.group_user,1,1,1,1 diff --git a/scrap_management/static/description/assets/icons/check.png b/scrap_management/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/scrap_management/static/description/assets/icons/check.png differ diff --git a/scrap_management/static/description/assets/icons/chevron.png b/scrap_management/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/scrap_management/static/description/assets/icons/chevron.png differ diff --git a/scrap_management/static/description/assets/icons/cogs.png b/scrap_management/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/scrap_management/static/description/assets/icons/cogs.png differ diff --git a/scrap_management/static/description/assets/icons/consultation.png b/scrap_management/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/scrap_management/static/description/assets/icons/consultation.png differ diff --git a/scrap_management/static/description/assets/icons/ecom-black.png b/scrap_management/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/scrap_management/static/description/assets/icons/ecom-black.png differ diff --git a/scrap_management/static/description/assets/icons/education-black.png b/scrap_management/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/scrap_management/static/description/assets/icons/education-black.png differ diff --git a/scrap_management/static/description/assets/icons/hotel-black.png b/scrap_management/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/scrap_management/static/description/assets/icons/hotel-black.png differ diff --git a/scrap_management/static/description/assets/icons/license.png b/scrap_management/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/scrap_management/static/description/assets/icons/license.png differ diff --git a/scrap_management/static/description/assets/icons/lifebuoy.png b/scrap_management/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/scrap_management/static/description/assets/icons/lifebuoy.png differ diff --git a/scrap_management/static/description/assets/icons/manufacturing-black.png b/scrap_management/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/scrap_management/static/description/assets/icons/manufacturing-black.png differ diff --git a/scrap_management/static/description/assets/icons/pos-black.png b/scrap_management/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/scrap_management/static/description/assets/icons/pos-black.png differ diff --git a/scrap_management/static/description/assets/icons/puzzle.png b/scrap_management/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/scrap_management/static/description/assets/icons/puzzle.png differ diff --git a/scrap_management/static/description/assets/icons/restaurant-black.png b/scrap_management/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/scrap_management/static/description/assets/icons/restaurant-black.png differ diff --git a/scrap_management/static/description/assets/icons/service-black.png b/scrap_management/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/scrap_management/static/description/assets/icons/service-black.png differ diff --git a/scrap_management/static/description/assets/icons/trading-black.png b/scrap_management/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/scrap_management/static/description/assets/icons/trading-black.png differ diff --git a/scrap_management/static/description/assets/icons/training.png b/scrap_management/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/scrap_management/static/description/assets/icons/training.png differ diff --git a/scrap_management/static/description/assets/icons/update.png b/scrap_management/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/scrap_management/static/description/assets/icons/update.png differ diff --git a/scrap_management/static/description/assets/icons/user.png b/scrap_management/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/scrap_management/static/description/assets/icons/user.png differ diff --git a/scrap_management/static/description/assets/icons/wrench.png b/scrap_management/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/scrap_management/static/description/assets/icons/wrench.png differ diff --git a/scrap_management/static/description/assets/misc/categories.png b/scrap_management/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/scrap_management/static/description/assets/misc/categories.png differ diff --git a/scrap_management/static/description/assets/misc/check-box.png b/scrap_management/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/scrap_management/static/description/assets/misc/check-box.png differ diff --git a/scrap_management/static/description/assets/misc/compass.png b/scrap_management/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/scrap_management/static/description/assets/misc/compass.png differ diff --git a/scrap_management/static/description/assets/misc/corporate.png b/scrap_management/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/scrap_management/static/description/assets/misc/corporate.png differ diff --git a/scrap_management/static/description/assets/misc/customer-support.png b/scrap_management/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/scrap_management/static/description/assets/misc/customer-support.png differ diff --git a/scrap_management/static/description/assets/misc/cybrosys-logo.png b/scrap_management/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/scrap_management/static/description/assets/misc/cybrosys-logo.png differ diff --git a/scrap_management/static/description/assets/misc/features.png b/scrap_management/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/scrap_management/static/description/assets/misc/features.png differ diff --git a/scrap_management/static/description/assets/misc/logo.png b/scrap_management/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/scrap_management/static/description/assets/misc/logo.png differ diff --git a/scrap_management/static/description/assets/misc/pictures.png b/scrap_management/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/scrap_management/static/description/assets/misc/pictures.png differ diff --git a/scrap_management/static/description/assets/misc/pie-chart.png b/scrap_management/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/scrap_management/static/description/assets/misc/pie-chart.png differ diff --git a/scrap_management/static/description/assets/misc/right-arrow.png b/scrap_management/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/scrap_management/static/description/assets/misc/right-arrow.png differ diff --git a/scrap_management/static/description/assets/misc/star.png b/scrap_management/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/scrap_management/static/description/assets/misc/star.png differ diff --git a/scrap_management/static/description/assets/misc/support.png b/scrap_management/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/scrap_management/static/description/assets/misc/support.png differ diff --git a/scrap_management/static/description/assets/misc/whatsapp.png b/scrap_management/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/scrap_management/static/description/assets/misc/whatsapp.png differ diff --git a/scrap_management/static/description/assets/modules/1.jpg b/scrap_management/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..c11ba602a Binary files /dev/null and b/scrap_management/static/description/assets/modules/1.jpg differ diff --git a/scrap_management/static/description/assets/modules/2.png b/scrap_management/static/description/assets/modules/2.png new file mode 100644 index 000000000..e281bd660 Binary files /dev/null and b/scrap_management/static/description/assets/modules/2.png differ diff --git a/scrap_management/static/description/assets/modules/3.png b/scrap_management/static/description/assets/modules/3.png new file mode 100644 index 000000000..66e5f3dd1 Binary files /dev/null and b/scrap_management/static/description/assets/modules/3.png differ diff --git a/scrap_management/static/description/assets/modules/4.png b/scrap_management/static/description/assets/modules/4.png new file mode 100644 index 000000000..d21466f5f Binary files /dev/null and b/scrap_management/static/description/assets/modules/4.png differ diff --git a/scrap_management/static/description/assets/modules/5.png b/scrap_management/static/description/assets/modules/5.png new file mode 100644 index 000000000..baaa60084 Binary files /dev/null and b/scrap_management/static/description/assets/modules/5.png differ diff --git a/scrap_management/static/description/assets/modules/6.png b/scrap_management/static/description/assets/modules/6.png new file mode 100644 index 000000000..956a7e9c7 Binary files /dev/null and b/scrap_management/static/description/assets/modules/6.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-01.png b/scrap_management/static/description/assets/screenshots/scrap-01.png new file mode 100644 index 000000000..1db99ea6d Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-01.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-02.png b/scrap_management/static/description/assets/screenshots/scrap-02.png new file mode 100644 index 000000000..fb23c20e0 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-02.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-03.png b/scrap_management/static/description/assets/screenshots/scrap-03.png new file mode 100644 index 000000000..1437b2a18 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-03.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-04.png b/scrap_management/static/description/assets/screenshots/scrap-04.png new file mode 100644 index 000000000..11aadaac7 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-04.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-05.png b/scrap_management/static/description/assets/screenshots/scrap-05.png new file mode 100644 index 000000000..1dadf6cad Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-05.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-06.png b/scrap_management/static/description/assets/screenshots/scrap-06.png new file mode 100644 index 000000000..4970999f2 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-06.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-07.png b/scrap_management/static/description/assets/screenshots/scrap-07.png new file mode 100644 index 000000000..39149368b Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-07.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-08.png b/scrap_management/static/description/assets/screenshots/scrap-08.png new file mode 100644 index 000000000..603868187 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-08.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-09.png b/scrap_management/static/description/assets/screenshots/scrap-09.png new file mode 100644 index 000000000..0b8e985d2 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-09.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap-10.png b/scrap_management/static/description/assets/screenshots/scrap-10.png new file mode 100644 index 000000000..486a17904 Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap-10.png differ diff --git a/scrap_management/static/description/assets/screenshots/scrap.gif b/scrap_management/static/description/assets/screenshots/scrap.gif new file mode 100644 index 000000000..4a9e3872c Binary files /dev/null and b/scrap_management/static/description/assets/screenshots/scrap.gif differ diff --git a/scrap_management/static/description/banner.jpg b/scrap_management/static/description/banner.jpg new file mode 100644 index 000000000..31ed9ccbf Binary files /dev/null and b/scrap_management/static/description/banner.jpg differ diff --git a/scrap_management/static/description/icon.png b/scrap_management/static/description/icon.png new file mode 100644 index 000000000..bb189eaf7 Binary files /dev/null and b/scrap_management/static/description/icon.png differ diff --git a/scrap_management/static/description/index.html b/scrap_management/static/description/index.html new file mode 100644 index 000000000..0f37b8f0f --- /dev/null +++ b/scrap_management/static/description/index.html @@ -0,0 +1,609 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Automated Scrap Order +

+

+ This Module helps to Manage Products Based on Expiry Date + and Moves to Scrap. +

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

+ Explore This Module

+
+ + + +
+
+ +
+

+ Overview +

+
+
+
+ This module helps to manage the Scrap Orders based on expiration date in + Odoo. This checks the expiry date of a product and move to scrap if it + is expired. We can also get the complete report of it using the scrap + report option. +
+
+ + +
+
+ +
+

+ Features +

+
+
+
+
+ + Simplified Scrap Management +
+
+ + Manages Scrap orders for Expired Product +
+
+ + Automatic creation of orders based on Expiry +
+
+ + Easier Analysis using Scrap Order Reports. +
+
+
+ + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

+ Enable Move to Scrap Option in Configuration Settings +

+ +
+
+

+ Enable the Tracking and Expiration Date in Product +

+ +
+
+

+ Create a Receipt Transfer and Provide Lot Number and Expiration + Date for the Product. +

+ +
+
+

+ Move Date in Lot and Serial Number will be calculated based on + Expiry of Product +

+ +
+
+

+ Automatic Scrap Orders in Draft Stage will be created based on + Move Date +

+ +
+
+

+ Validate the Scrap Orders +

+ +
+
+

+ View Reporting of Scrap Orders from Reporting → Scrap Order. +

+ +
+
+

+ A Wizard Opens with Fields to Filter the Reports.Users can + Filter the Records Based on the Values Providing or Leave Empty + to Include All Values. +

+ +
+
+

+ By Clicking on Print PDF Button, you can get PDF Reporting of + Scrap Orders. Below is the Sample Report. +

+ +
+
+

+ By Clicking on Print XLSX Button, you can get the Scrap Order + Reporting in Excel Format. +

+ +
+
+
+ + +
+
+ +
+

+ 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

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/scrap_management/static/src/js/scrap_management.js b/scrap_management/static/src/js/scrap_management.js new file mode 100644 index 000000000..6c71771a9 --- /dev/null +++ b/scrap_management/static/src/js/scrap_management.js @@ -0,0 +1,21 @@ +/** @odoo-module */ +/** + * registers a new handler to generate xlsx report + */ +import { registry } from "@web/core/registry"; +import framework from 'web.framework'; +import session from 'web.session'; +registry.category("ir.actions.report handlers").add("reportXlsx", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/report_xlsx', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); \ No newline at end of file diff --git a/scrap_management/views/res_config_settings_views.xml b/scrap_management/views/res_config_settings_views.xml new file mode 100644 index 000000000..4f38c1eb6 --- /dev/null +++ b/scrap_management/views/res_config_settings_views.xml @@ -0,0 +1,40 @@ + + + + + + res.config.settings.view.form.inherit.scrap.management + + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/scrap_management/views/stock_lot_views.xml b/scrap_management/views/stock_lot_views.xml new file mode 100644 index 000000000..d4aaf7919 --- /dev/null +++ b/scrap_management/views/stock_lot_views.xml @@ -0,0 +1,15 @@ + + + + + stock.lot.view.form.inherit.scrap.management + stock.lot + + + + + + + + + \ No newline at end of file diff --git a/scrap_management/wizard/__init__.py b/scrap_management/wizard/__init__.py new file mode 100644 index 000000000..187b6fa30 --- /dev/null +++ b/scrap_management/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna (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 scrap_report diff --git a/scrap_management/wizard/scrap_report.py b/scrap_management/wizard/scrap_report.py new file mode 100644 index 000000000..347df69cc --- /dev/null +++ b/scrap_management/wizard/scrap_report.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Shafna K(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 . +# +############################################################################### +import io +import json +from odoo import fields, models, _ +from odoo.exceptions import ValidationError +from odoo.tools import date_utils + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class ScrapReport(models.TransientModel): + """Transient model to give the input values for the + generation of report values""" + _name = "scrap.report" + _description = "Scrap Report Wizard" + + from_date = fields.Date(string="From Date", help="From this date report" + "values are taken") + to_date = fields.Date(string="To Date", help="To this date the report " + "values are taken") + product_id = fields.Many2one('product.product', string="Product", + help="choose the product of which the detail " + "should be known") + + def action_pdf_report(self): + """ To pass values in wizard""" + if self.from_date and self.to_date: + if self.from_date > self.to_date: + raise ValidationError(_("From Date can't be greater than" + " to date")) + if self.from_date: + if self.from_date > fields.Date.today(): + raise ValidationError(_("From date cannot be future date")) + data = { + 'model_id': self.id, + 'from_date': self.from_date, + 'to_date': self.to_date, + 'product_id': self.product_id.product_tmpl_id.id, + } + return self.env.ref( + 'scrap_management.scrap_order_report').report_action( + None, data=data) + + def action_xlsx_report(self): + """ To print the XLSX report type""" + if self.from_date and self.to_date: + if self.from_date > self.to_date: + raise ValidationError(_("From date can't be greater than " + "To date")) + if self.from_date: + if self.from_date > fields.Date.today(): + raise ValidationError(_("From date cannot be future date")) + query = self.env[ + 'report.scrap_management.report_scrap_order'].query_data( + self.from_date, self.to_date, self.product_id.product_tmpl_id.id) + data = { + 'from_date': self.from_date, + 'to_date': self.to_date, + 'product_id': self.product_id.product_tmpl_id.id, + 'var': query + } + return { + 'type': 'ir.actions.report', + 'data': {'model': 'scrap.report', + 'options': json.dumps(data, + default=date_utils.json_default), + 'output_format': 'xlsx', + 'report_name': 'Scrap Order Report', + }, + 'report_type': 'xlsx', + } + + def get_xlsx_report(self, data, response): + """To get the report values for xlsx report""" + from_date = data['from_date'] + to_date = data['to_date'] + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + cell_format = workbook.add_format( + {'font_size': '12px', 'bold': True, 'align': 'center'}) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + txt = workbook.add_format({'font_size': '10px', 'align': 'left'}) + txt_head = workbook.add_format({'font_size': '10px', 'align': 'left', + 'bold': True}) + sheet.set_column(0, 0, 20) + sheet.set_column(1, 1, 10) + sheet.set_column(2, 2, 10) + sheet.merge_range('A1:B1', 'Report Date:'+str(fields.Date.today()), + txt_head) + sheet.merge_range('A2:D3', 'SCRAP ORDER REPORT', head) + if from_date: + sheet.write('A4', 'From Date:', txt_head) + sheet.write('A5', from_date, txt) + if to_date: + sheet.write('B4', 'To Date:', txt_head) + sheet.write('B5', to_date, txt) + sheet.write('A6', 'Product', cell_format) + sheet.write('B6', 'Quantity', cell_format) + sheet.write('C6', 'Date', cell_format) + row = 6 + for records in data['var']: + sheet.write(row, 0, records['product']['en_US'], txt) + sheet.write(row, 1, records['quantity'], txt) + sheet.write(row, 2, records['date'], txt) + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/scrap_management/wizard/scrap_report_views.xml b/scrap_management/wizard/scrap_report_views.xml new file mode 100644 index 000000000..ca8008c9b --- /dev/null +++ b/scrap_management/wizard/scrap_report_views.xml @@ -0,0 +1,44 @@ + + + + + scrap.report.view.form + scrap.report + +
+ + + + + + + + + +
+
+
+
+
+ + + Scrap Order Report + scrap.report + form + + new + + + +
\ No newline at end of file