10 changed files with 274 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<https://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import models |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<https://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': 'Expiry Date Warning', |
|||
'summary': """Generates Warning for Expired Products, When it sells.""", |
|||
'version': '10.0.1.0.0', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'website': "http://www.cybrosys.com", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
"category": "Sales", |
|||
"depends": ["sale", "stock", "product", "product_expiry"], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'application': False, |
|||
} |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<https://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import expiry_date_warning |
@ -0,0 +1,80 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<https://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from datetime import datetime, date |
|||
from odoo import models, api, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ExpiryDateWarning(models.Model): |
|||
_inherit = 'sale.order.line' |
|||
|
|||
@api.onchange('product_uom', 'product_uom_qty') |
|||
def product_uom_change(self): |
|||
super(ExpiryDateWarning, self).product_uom_change() |
|||
if self.product_id: |
|||
total_quantity = 0.0 |
|||
product_sale = self.product_id |
|||
quantity_in_lot = self.env['stock.quant'].search([]) |
|||
lot_number_obj = self.env['stock.production.lot'] |
|||
lot_number_obj_specific = lot_number_obj.search([]) |
|||
for records in lot_number_obj_specific: |
|||
dates = date.today() |
|||
if records.life_date: |
|||
dates = datetime.strptime(records.life_date, '%Y-%m-%d %H:%M:%S').date() |
|||
if records.product_id.id == product_sale.id and dates < date.today(): |
|||
for values in quantity_in_lot: |
|||
if values.lot_id.id == records.id and values.product_id.id == product_sale.id: |
|||
total_quantity = total_quantity+values.qty |
|||
good_products = self.product_id.qty_available - total_quantity |
|||
if good_products < self.product_uom_qty: |
|||
warning_mess = { |
|||
'title': _('Not enough good products!'), |
|||
'message': _( |
|||
'You plan to sell %.2f %s but you only have %.2f %s Good Products available!\n' |
|||
'The stock on hand is %.2f %s.') % ( |
|||
self.product_uom_qty, self.product_uom.name, good_products, self.product_id.uom_id.name, |
|||
self.product_id.qty_available, self.product_id.uom_id.name) |
|||
} |
|||
return {'warning': warning_mess} |
|||
|
|||
|
|||
class ExpiryDateStockPackOperation(models.Model): |
|||
_inherit = "stock.pack.operation" |
|||
|
|||
@api.multi |
|||
def save(self): |
|||
res = super(ExpiryDateStockPackOperation, self).save() |
|||
lots = [x.lot_id for x in self.pack_lot_ids] |
|||
lot_list = [] |
|||
for lot in lots: |
|||
if self.product_id == lot.product_id: |
|||
if lot.life_date: |
|||
today = date.today() |
|||
life_date = datetime.strptime(lot.life_date, '%Y-%m-%d %H:%M:%S').date() |
|||
if life_date < today: |
|||
lot_list.append(str(lot.name)) |
|||
if len(lot_list) == 1: |
|||
raise UserError(_('Product in this lot number is expired : %s' % lot_list[0])) |
|||
elif len(lot_list) > 1: |
|||
raise UserError(_('Products in these lot numbers are expired : %s' % lot_list)) |
|||
return res |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,112 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">Expiry Date Warning !</h2> |
|||
<h3 class="oe_slogan">Generates warning for expired products, when we sell the product.</h3> |
|||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4> |
|||
</div> |
|||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|||
<h4>Features:</h4> |
|||
<div> |
|||
<span style="color:green;"> ☑ </span>Both Sales and Inventory Section Gets the Warning Message<br/> |
|||
<span style="color:green;"> ☑ </span>Integrate with Products Expiration Date Module.<br/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<p class="oe_mt32"> |
|||
In Odoo ERP you can set expiry date for any product. But what if we failed |
|||
to notice an expired product and attempt to sell the same? Expiry Date Warning |
|||
App by team Cybrosys solve the issue by generating a warning message while you |
|||
try to sell an expired product. This app uses the "End of life date" you set |
|||
for a product to generate the warning. So first, you need to set an Expiry |
|||
date for a product. |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
Read this blog from Cybrosys to know "How to set expiry date for a product". |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
Blog : https://www.cybrosys.com/blog/how-setup-product-expiry-dates-in-odoo |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Warning in Sale order</h3> |
|||
<div> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;height: 400px;" src="expiry11.png"> |
|||
</div> |
|||
<span style="text-align: center">If you select a product that does not have good products in the |
|||
inventory, you will get this error message.</span> |
|||
</div> |
|||
<br> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Warning at Stock Picking</h3> |
|||
<div class="" style="text-align: center"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;height: 400px;" src="expiry22.png"> |
|||
</div> |
|||
<span>This warning is generated when you pick some expired product from |
|||
the inventory.</span> |
|||
</div> |
|||
<br> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Define expiry date</h3> |
|||
<div> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img style="border:10px solid white;" src="expiry33.png"> |
|||
</div> |
|||
<p class="oe_mt32"> |
|||
You can set expiry date from |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
Inventory --> Inventory Control --> Lots/Serial Numbers |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
The app generate Expiry warning based on the date you give on "End of Life" field. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
|
|||
|
Loading…
Reference in new issue