diff --git a/product_expiry_warning/README.md b/product_expiry_warning/README.md new file mode 100755 index 000000000..1bc31e3c8 --- /dev/null +++ b/product_expiry_warning/README.md @@ -0,0 +1,38 @@ +Expiry Date Warning +========================= + +Generates warning for expired products, while selling the product. + + +Installation +============ +- www.odoo.com/documentation/13.0/setup/install.html +- Install our custom addons + +License +======= + +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (AGPL-3) + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ + +Developer: 10.0 Avinash Nk (odoo@cybrosys.com) + 12.0 Kavya Raveendran(odoo@cybrosys.com) + 13.0 Vaishnavi B(odoo@cybrosys.com) + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + diff --git a/product_expiry_warning/__init__.py b/product_expiry_warning/__init__.py new file mode 100644 index 000000000..e54325c59 --- /dev/null +++ b/product_expiry_warning/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Avinash Nk(odoo@cybrosys.com) +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (AGPL 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 . +# +############################################################################## +from . import models diff --git a/product_expiry_warning/__manifest__.py b/product_expiry_warning/__manifest__.py new file mode 100644 index 000000000..3771356ac --- /dev/null +++ b/product_expiry_warning/__manifest__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Avinash Nk (odoo@cybrosys.com) +# you can modify it under the terms of the GNU LESSER +# 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 LESSER GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Expiry Date Warning', + 'summary': """Generates Warning for Expired Products, When it sells.""", + 'version': '13.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': 'AGPL-3', + 'installable': True, + 'application': False, +} diff --git a/product_expiry_warning/doc/RELEASE_NOTES.md b/product_expiry_warning/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..217e0c5d5 --- /dev/null +++ b/product_expiry_warning/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 11.11.2019 +#### Version 13.0.1.0.0 +#### ADD + +Initial Commit diff --git a/product_expiry_warning/models/__init__.py b/product_expiry_warning/models/__init__.py new file mode 100644 index 000000000..70c57d0dc --- /dev/null +++ b/product_expiry_warning/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Avinash Nk(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 expiry_date_warning diff --git a/product_expiry_warning/models/expiry_date_warning.py b/product_expiry_warning/models/expiry_date_warning.py new file mode 100644 index 000000000..265e24fb8 --- /dev/null +++ b/product_expiry_warning/models/expiry_date_warning.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Avinash Nk() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 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 . +# +############################################################################## +from datetime import datetime, date +from odoo import api, fields, models, _ +from odoo.exceptions import UserError, ValidationError + + +class ExpiryDateWarning(models.Model): + _inherit = 'sale.order.line' + + @api.onchange('product_id', 'product_uom_qty') + def product_uom_change(self): + print("uom") + 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() + print(dates,"dates") + print(dates, "dates") + if records.life_date: + dates = datetime.strptime(str(records.life_date), '%Y-%m-%d %H:%M:%S') + print(dates,"datessssssssssss") + if records.product_id.id == product_sale.id: + if records.life_date and records.life_date.date() < date.today(): + for values in quantity_in_lot: + if values.lot_id.id == records.id and values.product_id.id == product_sale.id: + if values.quantity >= 0: + total_quantity = total_quantity + values.quantity + # elif records.product_id.id == product_sale.id and dates.date() is False: + # raise ValidationError(_("Set lot number and expiration date.")) + 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.picking' + + @api.onchange('move_line_ids_without_package') + def move_line_ids_change(self): + print("move_line_ids_change") + lots = self.move_line_ids.lot_id + lot_list = [] + for lot in lots: + if self.product_id == lot.product_id: + if lot.life_date: + today = date.today() + life_date = datetime.strptime(str(lot.life_date), '%Y-%m-%d %H:%M:%S') + if life_date.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)) diff --git a/product_expiry_warning/static/description/banner.jpg b/product_expiry_warning/static/description/banner.jpg new file mode 100644 index 000000000..84a872d44 Binary files /dev/null and b/product_expiry_warning/static/description/banner.jpg differ diff --git a/product_expiry_warning/static/description/icon.png b/product_expiry_warning/static/description/icon.png new file mode 100644 index 000000000..0e1393e97 Binary files /dev/null and b/product_expiry_warning/static/description/icon.png differ diff --git a/product_expiry_warning/static/description/index.html b/product_expiry_warning/static/description/index.html new file mode 100644 index 000000000..45ba76fe5 --- /dev/null +++ b/product_expiry_warning/static/description/index.html @@ -0,0 +1,333 @@ +
+
+

+ Expiry Date Warning +

+

+ Generates warning for expired products, when we sell the product. +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+
+
+

+ Overview +

+

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

+
+
+

+ Read this blog from Cybrosys to know "How to set expiry date for a product". +
Blog : https://www.cybrosys.com/blog/how-setup-product-expiry-dates-in-odoo +

+
+
+
+
+

+ Features +

+

+ + Both Sales and Inventory Section Gets the Warning Message +

+

+ + Integrate with Products Expiration Date Module +

+
+
+
+
+

+ Screenshots +

+

+ + Warning in Sale order
      If you select a product that does not have good products in the + inventory, you will get this error message. +

+
+ +
+

+ + Warning at Stock Picking
+       This warning is generated when you pick some expired product from + the inventory. +

+
+ +
+

+ + Define expiry date
+      You can set expiry date from Inventory --> Inventory Control --> Lots/Serial Numbers
+      The app generate Expiry warning based on the date you give on "End of Life" field. +

+
+ +
+
+
+
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+ +
+
+
+
+

+ Our Industries +

+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/product_expiry_warning/static/description/product_expiry_warning1.png b/product_expiry_warning/static/description/product_expiry_warning1.png new file mode 100644 index 000000000..7c8a00b7c Binary files /dev/null and b/product_expiry_warning/static/description/product_expiry_warning1.png differ diff --git a/product_expiry_warning/static/description/product_expiry_warning2.png b/product_expiry_warning/static/description/product_expiry_warning2.png new file mode 100644 index 000000000..b9b004386 Binary files /dev/null and b/product_expiry_warning/static/description/product_expiry_warning2.png differ diff --git a/product_expiry_warning/static/description/product_expiry_warning3.png b/product_expiry_warning/static/description/product_expiry_warning3.png new file mode 100644 index 000000000..3042161ef Binary files /dev/null and b/product_expiry_warning/static/description/product_expiry_warning3.png differ