diff --git a/product_batch_report/README.rst b/product_batch_report/README.rst new file mode 100644 index 000000000..38c343180 --- /dev/null +++ b/product_batch_report/README.rst @@ -0,0 +1,41 @@ +.. image:: https://img.shields.io/badge/licence-OPL--1-blue.svg + :target: http://www.gnu.org/licenses/opl-1.0-standalone.html + :alt: License: OPL-1 + +Lot and Serial Number Expiry Report +======================= +Generates a report based on lot and serial number expiry dates or product expiry date. + +Configuration +============= +The user should be added to the security group: Administrator(Inventory/ Stock) inorder to get access to the new menu. + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: Prasanna Kumara B @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/product_batch_report/__init__.py b/product_batch_report/__init__.py new file mode 100644 index 000000000..988a9f87b --- /dev/null +++ b/product_batch_report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-JANUARY Cybrosys Technologies(). +# Author: PRASANNA KUMARA B () +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +######################################################################################## +from . import wizard diff --git a/product_batch_report/__manifest__.py b/product_batch_report/__manifest__.py new file mode 100644 index 000000000..5b98210ba --- /dev/null +++ b/product_batch_report/__manifest__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-JANUARY Cybrosys Technologies(). +# Author: PRASANNA KUMARA B () +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +######################################################################################## +{ + 'name': 'Lot and Serial Number Expiry Report', + 'version': '16.0.1.0.0', + 'summary': 'Generates a detailed Lot and Serial Number Expiry based on their expiry details.', + 'description': """ This module helps you to print a report about tracking products + (lot/serial) based on their expiry date. You can filter your report based on different + criteria.""", + 'category': 'Inventory/Inventory', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base', 'stock'], + 'website': 'https://www.cybrosys.com', + 'data': [ + 'security/ir.model.access.csv', + 'report/product_batch_report_reports.xml', + 'report/product_batch_report_templates.xml', + 'wizard/product_batch_report_views.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'OPL-1', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/product_batch_report/doc/RELEASE_NOTES.md b/product_batch_report/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..5467a44e6 --- /dev/null +++ b/product_batch_report/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 27.02.2023 +#### Version 16.0.1.0.0 +#### ADD + +- Initial commit for Lot and Serial Number Expiry Report diff --git a/product_batch_report/report/product_batch_report_reports.xml b/product_batch_report/report/product_batch_report_reports.xml new file mode 100644 index 000000000..b775a2fe9 --- /dev/null +++ b/product_batch_report/report/product_batch_report_reports.xml @@ -0,0 +1,12 @@ + + + + + Lot/Serial Number Expiry PDF Report + product.batch.report + qweb-pdf + product_batch_report.product_batch_report_template + product_batch_report.product_batch_report_template + True + + \ No newline at end of file diff --git a/product_batch_report/report/product_batch_report_templates.xml b/product_batch_report/report/product_batch_report_templates.xml new file mode 100644 index 000000000..f5ce27454 --- /dev/null +++ b/product_batch_report/report/product_batch_report_templates.xml @@ -0,0 +1,92 @@ + + + + + \ No newline at end of file diff --git a/product_batch_report/security/ir.model.access.csv b/product_batch_report/security/ir.model.access.csv new file mode 100644 index 000000000..2f5140bf1 --- /dev/null +++ b/product_batch_report/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_product_batch_report_user,product.batch.report user,model_product_batch_report,stock.group_stock_user,1,0,0,0 +access_product_batch_report_manager,product.batch.report manager,model_product_batch_report,stock.group_stock_manager,1,1,1,1 \ No newline at end of file diff --git a/product_batch_report/static/description/assets/icons/check.png b/product_batch_report/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/product_batch_report/static/description/assets/icons/check.png differ diff --git a/product_batch_report/static/description/assets/icons/chevron.png b/product_batch_report/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/chevron.png differ diff --git a/product_batch_report/static/description/assets/icons/cogs.png b/product_batch_report/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/cogs.png differ diff --git a/product_batch_report/static/description/assets/icons/consultation.png b/product_batch_report/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/product_batch_report/static/description/assets/icons/consultation.png differ diff --git a/product_batch_report/static/description/assets/icons/ecom-black.png b/product_batch_report/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/ecom-black.png differ diff --git a/product_batch_report/static/description/assets/icons/education-black.png b/product_batch_report/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/product_batch_report/static/description/assets/icons/education-black.png differ diff --git a/product_batch_report/static/description/assets/icons/hotel-black.png b/product_batch_report/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/product_batch_report/static/description/assets/icons/hotel-black.png differ diff --git a/product_batch_report/static/description/assets/icons/license.png b/product_batch_report/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/product_batch_report/static/description/assets/icons/license.png differ diff --git a/product_batch_report/static/description/assets/icons/lifebuoy.png b/product_batch_report/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/product_batch_report/static/description/assets/icons/lifebuoy.png differ diff --git a/product_batch_report/static/description/assets/icons/logo.png b/product_batch_report/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/product_batch_report/static/description/assets/icons/logo.png differ diff --git a/product_batch_report/static/description/assets/icons/manufacturing-black.png b/product_batch_report/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/product_batch_report/static/description/assets/icons/manufacturing-black.png differ diff --git a/product_batch_report/static/description/assets/icons/pos-black.png b/product_batch_report/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/pos-black.png differ diff --git a/product_batch_report/static/description/assets/icons/puzzle.png b/product_batch_report/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/puzzle.png differ diff --git a/product_batch_report/static/description/assets/icons/restaurant-black.png b/product_batch_report/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/restaurant-black.png differ diff --git a/product_batch_report/static/description/assets/icons/service-black.png b/product_batch_report/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/product_batch_report/static/description/assets/icons/service-black.png differ diff --git a/product_batch_report/static/description/assets/icons/trading-black.png b/product_batch_report/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/product_batch_report/static/description/assets/icons/trading-black.png differ diff --git a/product_batch_report/static/description/assets/icons/training.png b/product_batch_report/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/product_batch_report/static/description/assets/icons/training.png differ diff --git a/product_batch_report/static/description/assets/icons/update.png b/product_batch_report/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/product_batch_report/static/description/assets/icons/update.png differ diff --git a/product_batch_report/static/description/assets/icons/user.png b/product_batch_report/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/product_batch_report/static/description/assets/icons/user.png differ diff --git a/product_batch_report/static/description/assets/icons/wrench.png b/product_batch_report/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/product_batch_report/static/description/assets/icons/wrench.png differ diff --git a/product_batch_report/static/description/assets/modules/1.png b/product_batch_report/static/description/assets/modules/1.png new file mode 100644 index 000000000..3415917c2 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/1.png differ diff --git a/product_batch_report/static/description/assets/modules/2.png b/product_batch_report/static/description/assets/modules/2.png new file mode 100644 index 000000000..31ed46762 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/2.png differ diff --git a/product_batch_report/static/description/assets/modules/3.png b/product_batch_report/static/description/assets/modules/3.png new file mode 100644 index 000000000..25ed3e0b6 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/3.png differ diff --git a/product_batch_report/static/description/assets/modules/4.png b/product_batch_report/static/description/assets/modules/4.png new file mode 100644 index 000000000..359d3e4d6 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/4.png differ diff --git a/product_batch_report/static/description/assets/modules/5.png b/product_batch_report/static/description/assets/modules/5.png new file mode 100644 index 000000000..3add135c3 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/5.png differ diff --git a/product_batch_report/static/description/assets/modules/6.png b/product_batch_report/static/description/assets/modules/6.png new file mode 100644 index 000000000..be454ea44 Binary files /dev/null and b/product_batch_report/static/description/assets/modules/6.png differ diff --git a/product_batch_report/static/description/assets/screenshots/1.png b/product_batch_report/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..b977c4ac5 Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/1.png differ diff --git a/product_batch_report/static/description/assets/screenshots/2.png b/product_batch_report/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..a2a692dc7 Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/2.png differ diff --git a/product_batch_report/static/description/assets/screenshots/3.png b/product_batch_report/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..bed702e50 Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/3.png differ diff --git a/product_batch_report/static/description/assets/screenshots/4.png b/product_batch_report/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..172561bc6 Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/4.png differ diff --git a/product_batch_report/static/description/assets/screenshots/5.png b/product_batch_report/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..312d0494e Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/5.png differ diff --git a/product_batch_report/static/description/assets/screenshots/6.png b/product_batch_report/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..df378a5e1 Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/6.png differ diff --git a/product_batch_report/static/description/assets/screenshots/hero-v16.gif b/product_batch_report/static/description/assets/screenshots/hero-v16.gif new file mode 100644 index 000000000..5cf291fcc Binary files /dev/null and b/product_batch_report/static/description/assets/screenshots/hero-v16.gif differ diff --git a/product_batch_report/static/description/banner.png b/product_batch_report/static/description/banner.png new file mode 100644 index 000000000..db4d0f8f2 Binary files /dev/null and b/product_batch_report/static/description/banner.png differ diff --git a/product_batch_report/static/description/icon.png b/product_batch_report/static/description/icon.png new file mode 100644 index 000000000..477fc1d80 Binary files /dev/null and b/product_batch_report/static/description/icon.png differ diff --git a/product_batch_report/static/description/index.html b/product_batch_report/static/description/index.html new file mode 100644 index 000000000..adbb0a219 --- /dev/null +++ b/product_batch_report/static/description/index.html @@ -0,0 +1,649 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+

+ Lot and Serial Number Expiry Report

+

+ Print a report on tracking products (lot/serial) based on their expiry date +

+ +
+
+ + + +
+
+

+ Overview +

+
+ +
+

+ This module helps you to print a report on tracking products (lot/serial) based on their expiry + date. One can filter their reports based on different criteria. +

+
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Genereate PDF Reports

+

+ Generates lot/serial number expiry report in PDF format.

+
+
+ +
+
+ +
+
+

+ Print Report Based on Lot/Serial Number or Product

+

+ Generates print report based on lot/serial number or based on products.

+
+
+ +
+
+ +
+
+

+ Filter Reports

+

+ Filtering of report based on expired or expiring traceable products.

+
+
+ +
+
+ +
+
+

+ Enter Days Rather than Date

+

+ Options to enter days rather than date.

+
+ +
+ + +
+ +
+
+

+ Screenshots +

+
+
+

+ Access from the reporting menu

+

+ Inventory --> Reporting --> Lot/Serial Expiry

+ +
+ +
+

+ Track expiry products or lots/serial number

+

+ Expiry report tracking by lots/serial number. +

+ +
+
+

+ Track expiry products or lots/serial number.

+

+ Expiry report tracking by products. +

+ +
+ +
+

+ Track selected set of products

+

+ Select the set of products to be tracked. +

+ +
+ +
+

+ Provide expiry date in terms of days

+

+ Enter the number of days before or within which the expiry takes place. +

+ +
+ +
+

+ PDF report based on the input.

+

+ A detailed PDF report based on input values. +

+ +
+ +
+ +
+
+

Related Modules

+

Explore our related modules

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

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/product_batch_report/wizard/__init__.py b/product_batch_report/wizard/__init__.py new file mode 100644 index 000000000..61e2eb1f6 --- /dev/null +++ b/product_batch_report/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-JANUARY Cybrosys Technologies(). +# Author: PRASANNA KUMARA B () +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +######################################################################################## +from . import product_batch_report diff --git a/product_batch_report/wizard/product_batch_report.py b/product_batch_report/wizard/product_batch_report.py new file mode 100644 index 000000000..6a2c40e3f --- /dev/null +++ b/product_batch_report/wizard/product_batch_report.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +###################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-JANUARY Cybrosys Technologies(). +# Author: PRASANNA KUMARA B () +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +######################################################################################## +from datetime import datetime, timedelta +from odoo import fields, models, _ +from odoo.exceptions import UserError + + +class StockMovesReportWizard(models.TransientModel): + _name = 'product.batch.report' + _description = 'Product Batch Report Wizard' + + tracking_wise = fields.Selection([ + ('tracking_wise', 'Lot/Serial Wise'), + ('product_wise', 'Product Wise'), ], + string='Tracking', default="tracking_wise", required=True) + product_ids = fields.Many2many('product.product', string='Product') + expiry_days = fields.Integer('Within') + expiry_type = fields.Selection([ + ('expired', 'Expired'), + ('expire', 'Going to Expire'), ], + string='Tracking Type', required=True) + + def generate_pdf_report(self): + """ + This Function generates the values required to print the + PDF report. This function takes below arguments and + return a data dictionary to the report template. + + :param self: object pointer. + :return data_dict: Returns filtered data of stock lot and serial data to the report template. + """ + expiration_config = self.env['res.config.settings'].search([], order='id desc', limit=1).mapped( + 'module_product_expiry') + if expiration_config: + if not expiration_config[0]: + raise UserError(_('Please enable Expiration Settings to get the Report.')) + else: + raise UserError(_('Please enable Expiration Settings to get the Report.')) + if self.expiry_days: + if self.expiry_days < 0: + raise UserError(_('Please Enter a Non Negative Number.')) + today = datetime.strftime(datetime.today(), '%Y-%m-%d %H:%M:%S') + batch_data = self.env['stock.lot'] + if self.product_ids: + for product in self.product_ids: + batch_data += batch_data.search( + [('product_id', '=', product.id), ('product_id.qty_available', '>', 0)]) + else: + batch_data = batch_data.search([('product_id.qty_available', '>', 0)]) + if self.expiry_type == 'expired': + batch_data = batch_data.filtered(lambda l: str(l.expiration_date) <= today) + else: + batch_data = batch_data.filtered(lambda l: str(l.expiration_date) >= today) + values = [] + heading = [] + date_within = '' + if self.expiry_days: + if self.expiry_type == 'expired': + date_within = datetime.strftime((datetime.today() - timedelta(days=int(self.expiry_days))), + '%Y-%m-%d %H:%M:%S') + batch_data = batch_data.filtered(lambda l: str(date_within) <= str(l.expiration_date) <= str(today)) + + else: + date_within = datetime.strftime((datetime.today() + timedelta(days=int(self.expiry_days))), + '%Y-%m-%d %H:%M:%S') + batch_data = batch_data.filtered(lambda l: str(date_within) >= str(l.expiration_date) >= str(today)) + batch_data = batch_data.filtered(lambda l: l.expiration_date) + for line in batch_data: + values.append({ + 'lot_name': line.name, + 'product': line.product_id.name, + 'expiry_date': line.expiration_date, + 'expiry_days': str( + (datetime.strptime(str(line.expiration_date), "%Y-%m-%d %H:%M:%S") - datetime.strptime( + today, "%Y-%m-%d %H:%M:%S")).days).replace("-", "") + " Days" + }) + if self.tracking_wise == 'tracking_wise': + heading.append({ + 'name': line.id + }) + else: + heading.append({ + 'name': line.product_id.name + }) + # To get product names + heading = [i for n, i in enumerate(heading) if i not in heading[n + 1:]] # duplicate check + view_type = self.tracking_wise + data_dict = { + 'values': values, + 'heading': heading, + 'view_type': view_type, + 'expiry_type': self.expiry_type, + 'today': today.split(' ')[0], + 'date_within': str(date_within).split(' ')[0], + 'expiry_days': self.expiry_days, + } + return self.env.ref('product_batch_report.product_batch_report_action_report').report_action(self, data=data_dict) diff --git a/product_batch_report/wizard/product_batch_report_views.xml b/product_batch_report/wizard/product_batch_report_views.xml new file mode 100644 index 000000000..8360ace78 --- /dev/null +++ b/product_batch_report/wizard/product_batch_report_views.xml @@ -0,0 +1,45 @@ + + + + + product.batch.report.view.form + product.batch.report + +
+ + + + + + + + + + +
+
+
+
+
+ + + + Lot or Serial Expiring Report + product.batch.report + ir.actions.act_window + form + new + + + + +