diff --git a/sale_amount_check/__init__.py b/sale_amount_check/__init__.py new file mode 100644 index 000000000..427d284cf --- /dev/null +++ b/sale_amount_check/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2016-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# 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 . +# +############################################################################## +import models diff --git a/sale_amount_check/__openerp__.py b/sale_amount_check/__openerp__.py new file mode 100644 index 000000000..4be6b60e0 --- /dev/null +++ b/sale_amount_check/__openerp__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2016-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# 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': 'Excess Amount Warning', + 'version': '9.0.1.0.0', + 'summary': 'Prevent Invoice Creation When Down Payment is Greater Than SO Total', + 'description': """Prevent Invoice Creation When Down Payment is Greater Than SO Total""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "http://www.cybrosys.com", + 'category': 'Sales', + 'website': 'www.cybrosys.com', + 'depends': [ + 'base', + 'sale', + 'stock' + ], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, +} diff --git a/sale_amount_check/models/__init__.py b/sale_amount_check/models/__init__.py new file mode 100644 index 000000000..4261bc401 --- /dev/null +++ b/sale_amount_check/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2016-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# 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 . +# +############################################################################## +import warning_sale_invoice diff --git a/sale_amount_check/models/warning_sale_invoice.py b/sale_amount_check/models/warning_sale_invoice.py new file mode 100644 index 000000000..d388d57e1 --- /dev/null +++ b/sale_amount_check/models/warning_sale_invoice.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2016-TODAY Cybrosys Technologies(). +# Author: Cybrosys Technologies() +# 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 openerp import models, api, _ +from openerp.exceptions import UserError + + +class WarningOnSaleInvoice(models.TransientModel): + _inherit = 'sale.advance.payment.inv' + + @api.multi + def _create_invoice(self, order, so_line, amount): + total_inv = 0 + for invoices in self.env['account.invoice'].search([('origin', '=', order.name)]): + total_inv += invoices.amount_total + total_inv += amount + if total_inv > order.amount_total: + raise UserError(_('You are trying to invoice more than total price')) + return super(WarningOnSaleInvoice, self)._create_invoice(order, so_line, amount) diff --git a/sale_amount_check/static/description/banner.jpg b/sale_amount_check/static/description/banner.jpg new file mode 100644 index 000000000..ed4958061 Binary files /dev/null and b/sale_amount_check/static/description/banner.jpg differ diff --git a/sale_amount_check/static/description/cybro_logo.png b/sale_amount_check/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/sale_amount_check/static/description/cybro_logo.png differ diff --git a/sale_amount_check/static/description/icon.png b/sale_amount_check/static/description/icon.png new file mode 100644 index 000000000..e4c4bc8aa Binary files /dev/null and b/sale_amount_check/static/description/icon.png differ diff --git a/sale_amount_check/static/description/index.html b/sale_amount_check/static/description/index.html new file mode 100644 index 000000000..003da02a7 --- /dev/null +++ b/sale_amount_check/static/description/index.html @@ -0,0 +1,47 @@ +
+
+

Excess Amount Warning for Down Payment

+

It raise warning when a user try to pay down payment greater than sale order total amount

+

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+
+ +
+
+

Create invoice with down payment

+
+

+ ☛ Error message when you try to invoice a greater value than SO total amount
+

+
+ +
+
+
+
+ +
+

Need Any Help?

+ +
diff --git a/sale_amount_check/static/description/warning.png b/sale_amount_check/static/description/warning.png new file mode 100644 index 000000000..d3745c70e Binary files /dev/null and b/sale_amount_check/static/description/warning.png differ