diff --git a/product_expiry_warning/README.md b/product_expiry_warning/README.md new file mode 100755 index 000000000..1ed46fd86 --- /dev/null +++ b/product_expiry_warning/README.md @@ -0,0 +1,35 @@ +Expiry Date Warning +=================== + +Generates warning for expired products, when we sell the product. + +Installation +============ +- www.odoo.com/documentation/11.0/setup/install.html +- Install our custom addon + +License +======= +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (LGPLv3) +(http://www.gnu.org/licenses) + +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 +------ + +Developers: Odoo-10.0, Avinash Nk(odoo@cybrosys.com) + Odoo-11.0, Meera K (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..7d5aa7fc2 --- /dev/null +++ b/product_expiry_warning/__init__.py @@ -0,0 +1,23 @@ +# -*- 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. +# +# 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..b8bee3256 --- /dev/null +++ b/product_expiry_warning/__manifest__.py @@ -0,0 +1,36 @@ +# -*- 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. +# +# 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 . +# +############################################################################## +{ + 'name': 'Expiry Date Warning', + 'summary': """Generates Warning for Expired Products, When it sells.""", + 'version': '11.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, +} diff --git a/product_expiry_warning/models/__init__.py b/product_expiry_warning/models/__init__.py new file mode 100644 index 000000000..0626a6ef0 --- /dev/null +++ b/product_expiry_warning/models/__init__.py @@ -0,0 +1,23 @@ +# -*- 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. +# +# 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 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..23c512b1a --- /dev/null +++ b/product_expiry_warning/models/expiry_date_warning.py @@ -0,0 +1,78 @@ +# -*- 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. +# +# 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 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: + if values.quantity >= 0: + total_quantity = total_quantity + values.quantity + 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.move.line" + + @api.onchange('lot_id') + def get_exp(self): + lot_list = [] + for lot in self.lot_id: + 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])) \ No newline at end of file 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..684b9afcd --- /dev/null +++ b/product_expiry_warning/static/description/index.html @@ -0,0 +1,356 @@ +
+
+

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

+
+
+ +
+
+

+ 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 --> Master Data --> Lots/Serial Numbers. + The app generate Expiry warning based on the date you give on "End of Life" field. +

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

+ Our Services +

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

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ 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..4a6c9ee63 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..9dc69757f 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..47835e558 Binary files /dev/null and b/product_expiry_warning/static/description/product_expiry_warning3.png differ