Browse Source

May 23 : [ADD] Initial Commit 'product_batch_report'

pull/257/head
Sayooj 2 years ago
parent
commit
4d22211e14
  1. 41
      product_batch_report/README.rst
  2. 22
      product_batch_report/__init__.py
  3. 46
      product_batch_report/__manifest__.py
  4. 7
      product_batch_report/doc/RELEASE_NOTES.md
  5. 12
      product_batch_report/report/product_batch_report_reports.xml
  6. 92
      product_batch_report/report/product_batch_report_templates.xml
  7. 3
      product_batch_report/security/ir.model.access.csv
  8. BIN
      product_batch_report/static/description/assets/icons/check.png
  9. BIN
      product_batch_report/static/description/assets/icons/chevron.png
  10. BIN
      product_batch_report/static/description/assets/icons/cogs.png
  11. BIN
      product_batch_report/static/description/assets/icons/consultation.png
  12. BIN
      product_batch_report/static/description/assets/icons/ecom-black.png
  13. BIN
      product_batch_report/static/description/assets/icons/education-black.png
  14. BIN
      product_batch_report/static/description/assets/icons/hotel-black.png
  15. BIN
      product_batch_report/static/description/assets/icons/license.png
  16. BIN
      product_batch_report/static/description/assets/icons/lifebuoy.png
  17. BIN
      product_batch_report/static/description/assets/icons/logo.png
  18. BIN
      product_batch_report/static/description/assets/icons/manufacturing-black.png
  19. BIN
      product_batch_report/static/description/assets/icons/pos-black.png
  20. BIN
      product_batch_report/static/description/assets/icons/puzzle.png
  21. BIN
      product_batch_report/static/description/assets/icons/restaurant-black.png
  22. BIN
      product_batch_report/static/description/assets/icons/service-black.png
  23. BIN
      product_batch_report/static/description/assets/icons/trading-black.png
  24. BIN
      product_batch_report/static/description/assets/icons/training.png
  25. BIN
      product_batch_report/static/description/assets/icons/update.png
  26. BIN
      product_batch_report/static/description/assets/icons/user.png
  27. BIN
      product_batch_report/static/description/assets/icons/wrench.png
  28. BIN
      product_batch_report/static/description/assets/modules/1.png
  29. BIN
      product_batch_report/static/description/assets/modules/2.png
  30. BIN
      product_batch_report/static/description/assets/modules/3.png
  31. BIN
      product_batch_report/static/description/assets/modules/4.png
  32. BIN
      product_batch_report/static/description/assets/modules/5.png
  33. BIN
      product_batch_report/static/description/assets/modules/6.png
  34. BIN
      product_batch_report/static/description/assets/screenshots/1.png
  35. BIN
      product_batch_report/static/description/assets/screenshots/2.png
  36. BIN
      product_batch_report/static/description/assets/screenshots/3.png
  37. BIN
      product_batch_report/static/description/assets/screenshots/4.png
  38. BIN
      product_batch_report/static/description/assets/screenshots/5.png
  39. BIN
      product_batch_report/static/description/assets/screenshots/6.png
  40. BIN
      product_batch_report/static/description/assets/screenshots/hero-v16.gif
  41. BIN
      product_batch_report/static/description/banner.png
  42. BIN
      product_batch_report/static/description/icon.png
  43. 649
      product_batch_report/static/description/index.html
  44. 22
      product_batch_report/wizard/__init__.py
  45. 116
      product_batch_report/wizard/product_batch_report.py
  46. 45
      product_batch_report/wizard/product_batch_report_views.xml

41
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 <https://cybrosys.com/>`__
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 <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

22
product_batch_report/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
######################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-JANUARY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: PRASANNA KUMARA B (<https://www.cybrosys.com>)
#
# 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

46
product_batch_report/__manifest__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
######################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-JANUARY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: PRASANNA KUMARA B (<https://www.cybrosys.com>)
#
# 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,
}

7
product_batch_report/doc/RELEASE_NOTES.md

@ -0,0 +1,7 @@
## Module <product_batch_report>
#### 27.02.2023
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Lot and Serial Number Expiry Report

12
product_batch_report/report/product_batch_report_reports.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!--report action for Lot/Serial Number Expiry PDF Report-->
<record id="product_batch_report_action_report" model="ir.actions.report">
<field name="name">Lot/Serial Number Expiry PDF Report</field>
<field name="model">product.batch.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">product_batch_report.product_batch_report_template</field>
<field name="report_file">product_batch_report.product_batch_report_template</field>
<field name="attachment_use">True</field>
</record>
</odoo>

92
product_batch_report/report/product_batch_report_templates.xml

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- product_batch_report template-->
<template id="product_batch_report_template">
<t t-call="web.external_layout">
<t t-call="web.html_container">
<div class="page">
<h3 align="center">Lot/Serial Number Expiry Report</h3>
<div class="row mt32">
<!--printing from and to date of expiry based on expiry type-->
<t t-if="expiry_type =='expire'">
<div class="col-3">
<span>From :</span>
<strong t-esc="today"/>
</div>
<div class="col-12">
<span>To :</span>
<strong t-esc="date_within"/>
</div>
</t>
<t t-if="expiry_type =='expired'">
<div class="col-3">
<span>From :</span>
<strong t-esc="date_within"/>
</div>
<div class="col-12">
<span>To :</span>
<strong t-esc="today"/>
</div>
</t>
</div>
</div>
<!--printing report data inside a table-->
<table class="table table-condensed">
<thead>
<t t-if="view_type =='product_wise'">
<th>Product</th>
</t>
<th>Lot/Serial Number</th>
<th>Expiry Date</th>
<t t-if="expiry_type =='expire'">
<th>Expire Within</th>
</t>
<t t-if="expiry_type =='expired'">
<th>Expired Before</th>
</t>
</thead>
<tbody>
<!--displaying product expiry dates if the report type is product wise-->
<t t-if="view_type =='product_wise'">
<tr t-foreach="heading" t-as="doc">
<td align="left" colspan="4">
<strong>
<span t-esc="doc['name']" style="color:#515151"/>
</strong>
</td>
<tr t-foreach="values" t-as="doc2">
<t t-if="doc['name']==doc2['product']">
<td></td>
<td align="center">
<span t-esc="doc2['lot_name']"/>
</td>
<td align="center">
<span t-esc="doc2['expiry_date']"/>
</td>
<td align="center">
<span t-esc="doc2['expiry_days']"/>
</td>
</t>
</tr>
</tr>
</t>
<!--displaying lot/serial expiry dates if the report type is tracking_wise-->
<t t-if="view_type =='tracking_wise'">
<tr t-foreach="values" t-as="doc2">
<td align="center">
<span t-esc="doc2['lot_name']"/>
</td>
<td align="center">
<span t-esc="doc2['expiry_date']"/>
</td>
<td align="center">
<span t-esc="doc2['expiry_days']"/>
</td>
</tr>
</t>
</tbody>
</table>
</t>
</t>
</template>
</odoo>

3
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_batch_report_user product.batch.report user model_product_batch_report stock.group_stock_user 1 0 0 0
3 access_product_batch_report_manager product.batch.report manager model_product_batch_report stock.group_stock_manager 1 1 1 1

BIN
product_batch_report/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
product_batch_report/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
product_batch_report/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
product_batch_report/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
product_batch_report/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
product_batch_report/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
product_batch_report/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
product_batch_report/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
product_batch_report/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
product_batch_report/static/description/assets/icons/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
product_batch_report/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
product_batch_report/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
product_batch_report/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
product_batch_report/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
product_batch_report/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
product_batch_report/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
product_batch_report/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
product_batch_report/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
product_batch_report/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
product_batch_report/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
product_batch_report/static/description/assets/modules/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
product_batch_report/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
product_batch_report/static/description/assets/modules/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
product_batch_report/static/description/assets/modules/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
product_batch_report/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
product_batch_report/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
product_batch_report/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
product_batch_report/static/description/assets/screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
product_batch_report/static/description/assets/screenshots/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
product_batch_report/static/description/assets/screenshots/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
product_batch_report/static/description/assets/screenshots/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
product_batch_report/static/description/assets/screenshots/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
product_batch_report/static/description/assets/screenshots/hero-v16.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

BIN
product_batch_report/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
product_batch_report/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

649
product_batch_report/static/description/index.html

@ -0,0 +1,649 @@
<div class="container" style="padding: 1rem !important; margin-bottom: 1rem !important;">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 d-flex justify-content-between"
style="border-bottom: 1px solid #d5d5d5;">
<div class="my-3">
<img src="assets/icons/logo.png" style="width: auto !important; height: 40px !important;">
</div>
<div class="my-3 d-flex align-items-center">
<div
style="background-color: #7C7BAD !important; color: #fff !important; font-weight: 600 !important; padding: 5px 15px 8px !important; margin: 0 5px !important;">
<i class="fa fa-check mr-1"></i>Community
</div>
<div
style="background-color: #875A7B !important; color: #fff !important; font-weight: 600 !important; padding: 5px 15px 8px !important; margin: 0 5px !important;">
<i class="fa fa-check mr-1"></i>Enterprise
</div>
</div>
</div>
</div>
</div>
<div class="container" style="padding: 0rem 1.5rem 4rem !important">
<div class="row" style="height: 900px !important;">
<div class="col-sm-12 col-md-12 col-lg-12"
style="padding: 4rem 1rem !important; background-color: #714B67 !important; height: 600px !important; border-radius: 20px !important;">
<h1
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #FFFFFF !important; font-size: 3.5rem !important; text-align: center !important;">
Lot and Serial Number Expiry Report</h1>
<p
style="font-family: 'Montserrat', sans-serif !important; font-weight: 300 !important; color: #FFFFFF !important; font-size: 1.4rem !important; text-align: center !important;">
Print a report on tracking products (lot/serial) based on their expiry date
</p>
<img src="assets/screenshots/hero-v16.gif" class="img-responsive" width="100%" height="auto"/>
</div>
</div>
<div class="row">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin-bottom: 2rem !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-compass mr-2"></i>Explore this module
</h2>
<div class="row">
<div class="col-md-6">
<a href="#overview" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Overview</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
Learn more about this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#features" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Features</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
View features of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#screenshots" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Screenshots</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
See key screenshots of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="row" id="overview">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-pie-chart mr-2"></i>Overview
</h2>
</div>
<div class="col-mg-12 pl-3">
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important; line-height: 30px !important;">
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.
</p>
</div>
</div>
<div class="row" id="features">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-star mr-2"></i>Features
</h2>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Genereate PDF Reports</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Generates lot/serial number expiry report in PDF format.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Print Report Based on Lot/Serial Number or Product</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Generates print report based on lot/serial number or based on products.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Filter Reports</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Filtering of report based on expired or expiring traceable products.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Enter Days Rather than Date</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Options to enter days rather than date.</p>
</div>
</div>
</div>
<div class="row" id="screenshots">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-image mr-2"></i>Screenshots
</h2>
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Access from the reporting menu</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Inventory --> Reporting --> Lot/Serial Expiry</p>
<img src="assets/screenshots/1.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Track expiry products or lots/serial number</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Expiry report tracking by lots/serial number.
</p>
<img src="assets/screenshots/2.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Track expiry products or lots/serial number.</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Expiry report tracking by products.
</p>
<img src="assets/screenshots/3.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Track selected set of products</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Select the set of products to be tracked.
</p>
<img src="assets/screenshots/4.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Provide expiry date in terms of days</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Enter the number of days before or within which the expiry takes place.
</p>
<img src="assets/screenshots/5.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
<div class="col-lg-12 my-3">
<h4 class="mt-3"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
PDF report based on the input.</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
A detailed PDF report based on input values.
</p>
<img src="assets/screenshots/6.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/>
</div>
</div>
<!-- SUGGESTED PRODUCTS -->
<div class="row">
<div class="col-sm-12 col-md-12-col-lg-2">
<h2 style="font-weight: bold; color: #3D3D4E;">Related Modules</h2>
<p style="color: #777783;">Explore our related modules</p>
<hr/>
</div>
<div class="col-sm-12">
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner" style="padding: 30px;">
<div class="carousel-item" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/whatsapp_redirect/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/1.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/hr_payroll_community/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/2.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/crm_dashboard/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/3.png">
</div>
</a>
</div>
</div>
<div class="carousel-item active" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/export_stockinfo_xls/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/4.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/sale_discount_total/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/5.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/fleet_rental/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/6.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="width:35px; color:#000"> <span
class="carousel-control-prev-icon"><i class="fa fa-chevron-left"
style="font-size:24px"></i></span>
</a> <a class="carousel-control-next" href="#demo1" data-slide="next"
style="width:35px; color:#000">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF SUGGESTED PRODUCTS -->
<!-- OUR SERVICES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Services</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Licensing Consultancy</h6>
</div>
</div>
</section>
<!-- END OF END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Industries</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/trading-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/pos-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/education-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/manufacturing-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</section>
<!-- END OF END OF OUR INDUSTRIES -->
<!-- FOOTER -->
<!-- Footer Section -->
<section class="container" style="margin: 5rem auto 2rem;">
<div class="row" style="max-width:1540px;">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Need Help?</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
</div>
</div>
<!-- Contact Cards -->
<div class="row d-flex justify-content-center align-items-center"
style="max-width:1540px; margin: 0 auto 2rem auto;">
<div class="col-lg-12" style="padding: 0rem 3rem 2rem; border-radius: 10px; margin-right: 3rem; ">
<div class="row mt-4">
<div class="col-lg-6">
<a href="mailto:odoo@cybrosys.com" target="_blank" class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #4d4d4d; color: #FFF; border-radius: 4px;"><i
class="fa fa-envelope mr-2"></i>odoo@cybrosys.com</a>
</div>
<div class="col-lg-6">
<a href="https://api.whatsapp.com/send?phone=918606827707" target="_blank"
class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #25D366; color: #FFF; border-radius: 4px;"><i
class="fa fa-whatsapp mr-2"></i>+91 86068 27707</a>
</div>
</div>
</div>
</div>
<!-- End of Contact Cards -->
</section>
<!-- Footer -->
<section class="oe_container" style="padding: 2rem 3rem 1rem;">
<div class="row" style="max-width:1540px; margin: 0 auto; margin-right: 3rem; ">
<!-- Logo -->
<div class="col-lg-12 d-flex justify-content-center align-items-center" style="margin-top: 3rem;">
<img src="https://www.cybrosys.com/images/logo.png" width="200px" height="auto"/>
</div>
<!-- End of Logo -->
<div class="col-lg-12">
<hr
style="margin-top: 3rem;background: linear-gradient(90deg, rgba(2,0,36,0) 0%, rgba(229,229,229,1) 33%, rgba(229,229,229,1) 58%, rgba(0,212,255,0) 100%); height: 2px; border-style: none;">
<!-- End of Footer Section -->
</div>
</div>
</section>
<!-- END OF FOOTER -->
</div>

22
product_batch_report/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
######################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-JANUARY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: PRASANNA KUMARA B (<https://www.cybrosys.com>)
#
# 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

116
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(<https://www.cybrosys.com>).
# Author: PRASANNA KUMARA B (<https://www.cybrosys.com>)
#
# 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)

45
product_batch_report/wizard/product_batch_report_views.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!--product_batch_report form view-->
<record id="product_batch_report_view_form" model="ir.ui.view">
<field name="name">product.batch.report.view.form</field>
<field name="model">product.batch.report</field>
<field name="arch" type="xml">
<form string="Product Lot or Serial Report">
<group>
<group>
<field name="tracking_wise"/>
<field name="product_ids" attrs="{'invisible':[('tracking_wise','=','tracking_wise')]}"
widget="many2many_tags"/>
<field name="expiry_type"/>
</group>
<group>
<label for="expiry_days"/>
<div>
<field name="expiry_days" class="oe_inline" widget="integer"/>
<span>Days</span>
</div>
</group>
</group>
<footer>
<button name="generate_pdf_report" string="PDF Report" type="object" class="oe_highlight"/>
<button string="Cancel" special="cancel"/>
</footer>
</form>
</field>
</record>
<!--product_batch_report menu action-->
<record id="product_batch_report_action" model="ir.actions.act_window">
<field name="name">Lot or Serial Expiring Report</field>
<field name="res_model">product.batch.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!--Lot or Serial expiry Report menu inside inventory-->
<menuitem id="product_batch_report_menu" name="Lot/Serial Expiry" action="product_batch_report_action"
parent="stock.menu_warehouse_report" sequence="200"/>
</odoo>
Loading…
Cancel
Save