diff --git a/account_payment_approval/README.rst b/account_payment_approval/README.rst new file mode 100644 index 000000000..01782b81d --- /dev/null +++ b/account_payment_approval/README.rst @@ -0,0 +1,17 @@ +Payment Approval v13 +==================== +Enables to use the approval feature in customer and vendor payments. + +Installation +============ +No additional files neeeded. + +Configuration +============= + +No configurations needed. + +Credits +======= +Developer: v13.0 Mashood K U @ cybrosys, odoo@cybrosys.com + diff --git a/account_payment_approval/__init__.py b/account_payment_approval/__init__.py new file mode 100644 index 000000000..9d876ea62 --- /dev/null +++ b/account_payment_approval/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import models diff --git a/account_payment_approval/__manifest__.py b/account_payment_approval/__manifest__.py new file mode 100644 index 000000000..1ab8358cf --- /dev/null +++ b/account_payment_approval/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +{ + 'name': 'Payment Approvals', + 'version': '13.0.1.0.0', + 'category': 'Accounting', + 'summary': """ This modules enables approval feature in the payment.""", + 'description': """This modules enables approval feature in the payment. """, + 'author': ' Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['account'], + 'data': [ + 'views/res_config_settings_views.xml', + 'views/account_payment_view.xml', + ], + 'license': 'LGPL-3', + 'images': ['static/description/banner.png'], + 'installable': True, + 'auto_install': False, + 'application': True, +} + diff --git a/account_payment_approval/doc/RELEASE_NOTES.md b/account_payment_approval/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d55ee7817 --- /dev/null +++ b/account_payment_approval/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 01.01.2020 +#### Version 13.0.1.0.0 +##### ADD +- Initial commit for Payment Approval diff --git a/account_payment_approval/models/__init__.py b/account_payment_approval/models/__init__.py new file mode 100644 index 000000000..0d61bd07a --- /dev/null +++ b/account_payment_approval/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import account_payment +from . import res_config_settings diff --git a/account_payment_approval/models/account_payment.py b/account_payment_approval/models/account_payment.py new file mode 100644 index 000000000..555445fb5 --- /dev/null +++ b/account_payment_approval/models/account_payment.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import models, fields, _ +from odoo.exceptions import UserError, ValidationError + + +class AccountPayment(models.Model): + _inherit = "account.payment" + + def _check_is_approver(self): + approval = self.env['ir.config_parameter'].sudo().get_param( + 'account_payment_approval.payment_approval') + approver_id = int(self.env['ir.config_parameter'].sudo().get_param( + 'account_payment_approval.approval_user_id')) + self.is_approver = True if self.env.user.id == approver_id and approval else False + + state = fields.Selection(selection_add=[('waiting_approval', 'Waiting For Approval'), + ('approved', 'Approved'), + ('rejected', 'Rejected')]) + is_approver = fields.Boolean(compute=_check_is_approver, readonly=True) + + def post(self): + """Overwrites the post() to validate the payment in the 'approved' stage too. + Currently Odoo allows payment posting only in draft stage. + """ + AccountMove = self.env['account.move'].with_context(default_type='entry') + for rec in self: + validation = rec._check_payment_approval() + if validation: + if rec.state not in ('draft', 'approved'): + raise UserError(_("Only a draft or approved payment can be posted.")) + + if any(inv.state != 'posted' for inv in rec.invoice_ids): + raise ValidationError(_("The payment cannot be processed because the invoice is not open!")) + + # keep the name in case of a payment reset to draft + if not rec.name: + # Use the right sequence to set the name + if rec.payment_type == 'transfer': + sequence_code = 'account.payment.transfer' + else: + if rec.partner_type == 'customer': + if rec.payment_type == 'inbound': + sequence_code = 'account.payment.customer.invoice' + if rec.payment_type == 'outbound': + sequence_code = 'account.payment.customer.refund' + if rec.partner_type == 'supplier': + if rec.payment_type == 'inbound': + sequence_code = 'account.payment.supplier.refund' + if rec.payment_type == 'outbound': + sequence_code = 'account.payment.supplier.invoice' + rec.name = self.env['ir.sequence'].next_by_code(sequence_code, sequence_date=rec.payment_date) + if not rec.name and rec.payment_type != 'transfer': + raise UserError(_("You have to define a sequence for %s in your company.") % (sequence_code,)) + + moves = AccountMove.create(rec._prepare_payment_moves()) + moves.filtered(lambda move: move.journal_id.post_at != 'bank_rec').post() + + # Update the state / move before performing any reconciliation. + move_name = self._get_move_name_transfer_separator().join(moves.mapped('name')) + rec.write({'state': 'posted', 'move_name': move_name}) + + if rec.payment_type in ('inbound', 'outbound'): + # ==== 'inbound' / 'outbound' ==== + if rec.invoice_ids: + (moves[0] + rec.invoice_ids).line_ids \ + .filtered( + lambda line: not line.reconciled and line.account_id == rec.destination_account_id) \ + .reconcile() + elif rec.payment_type == 'transfer': + # ==== 'transfer' ==== + moves.mapped('line_ids') \ + .filtered(lambda line: line.account_id == rec.company_id.transfer_account_id) \ + .reconcile() + + return True + + def _check_payment_approval(self): + if self.state == "draft": + first_approval = self.env['ir.config_parameter'].sudo().get_param( + 'account_payment_approval.payment_approval') + if first_approval: + amount = float(self.env['ir.config_parameter'].sudo().get_param( + 'account_payment_approval.approval_amount')) + payment_currency_id = int(self.env['ir.config_parameter'].sudo().get_param( + 'account_payment_approval.approval_currency_id')) + payment_amount = self.amount + if payment_currency_id: + if self.currency_id and self.currency_id.id != payment_currency_id: + currency_id = self.env['res.currency'].browse(payment_currency_id) + payment_amount = self.currency_id._convert( + self.amount, currency_id, self.company_id, + self.payment_date or fields.Date.today(), round=True) + if payment_amount > amount: + self.write({ + 'state': 'waiting_approval' + }) + return False + return True + + def approve_transfer(self): + if self.is_approver: + self.write({ + 'state': 'approved' + }) + + def reject_transfer(self): + self.write({ + 'state': 'rejected' + }) diff --git a/account_payment_approval/models/res_config_settings.py b/account_payment_approval/models/res_config_settings.py new file mode 100644 index 000000000..b892ae9b3 --- /dev/null +++ b/account_payment_approval/models/res_config_settings.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# 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 +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + def _get_account_manager_ids(self): + user_ids = self.env['res.users'].search([]) + account_manager_ids = user_ids.filtered(lambda l: l.has_group('account.group_account_manager')) + return [('id', 'in', account_manager_ids.ids)] + + payment_approval = fields.Boolean('Payment Approval', config_parameter='account_payment_approval.payment_approval') + approval_user_id = fields.Many2one('res.users', string="Approvar", required=False, + domain=_get_account_manager_ids, + config_parameter='account_payment_approval.approval_user_id') + approval_amount = fields.Float('Amount', config_parameter='account_payment_approval.approval_amount', + help="If amount is 0.00, All the payments go through approval.") + approval_currency_id = fields.Many2one('res.currency', string='Currency', + config_parameter='account_payment_approval.approval_currency_id', + help="Converts the payment amount to this currency if chosen.") diff --git a/account_payment_approval/static/description/banner.png b/account_payment_approval/static/description/banner.png new file mode 100644 index 000000000..13f84fc92 Binary files /dev/null and b/account_payment_approval/static/description/banner.png differ diff --git a/account_payment_approval/static/description/icon.png b/account_payment_approval/static/description/icon.png new file mode 100644 index 000000000..b3641912d Binary files /dev/null and b/account_payment_approval/static/description/icon.png differ diff --git a/account_payment_approval/static/description/images/banner-account-bank-book.png b/account_payment_approval/static/description/images/banner-account-bank-book.png new file mode 100644 index 000000000..088d9be88 Binary files /dev/null and b/account_payment_approval/static/description/images/banner-account-bank-book.png differ diff --git a/account_payment_approval/static/description/images/banner-account-cash-book.jpg b/account_payment_approval/static/description/images/banner-account-cash-book.jpg new file mode 100644 index 000000000..b7a48f2f4 Binary files /dev/null and b/account_payment_approval/static/description/images/banner-account-cash-book.jpg differ diff --git a/account_payment_approval/static/description/images/banner-account-day-book.png b/account_payment_approval/static/description/images/banner-account-day-book.png new file mode 100644 index 000000000..a3fced2e6 Binary files /dev/null and b/account_payment_approval/static/description/images/banner-account-day-book.png differ diff --git a/account_payment_approval/static/description/images/banner-account-recurring-payment.png b/account_payment_approval/static/description/images/banner-account-recurring-payment.png new file mode 100644 index 000000000..d7ed02cc9 Binary files /dev/null and b/account_payment_approval/static/description/images/banner-account-recurring-payment.png differ diff --git a/account_payment_approval/static/description/images/banner-accounting-kit.gif b/account_payment_approval/static/description/images/banner-accounting-kit.gif new file mode 100644 index 000000000..30b746d7f Binary files /dev/null and b/account_payment_approval/static/description/images/banner-accounting-kit.gif differ diff --git a/account_payment_approval/static/description/images/banner-customer-follow-ups.png b/account_payment_approval/static/description/images/banner-customer-follow-ups.png new file mode 100644 index 000000000..e2b85a997 Binary files /dev/null and b/account_payment_approval/static/description/images/banner-customer-follow-ups.png differ diff --git a/account_payment_approval/static/description/images/checked.png b/account_payment_approval/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/account_payment_approval/static/description/images/checked.png differ diff --git a/account_payment_approval/static/description/images/cybrosys.png b/account_payment_approval/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/account_payment_approval/static/description/images/cybrosys.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-01.png b/account_payment_approval/static/description/images/payment-approval-01.png new file mode 100644 index 000000000..1829b8364 Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-01.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-02.png b/account_payment_approval/static/description/images/payment-approval-02.png new file mode 100644 index 000000000..d4f72fcf6 Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-02.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-03.png b/account_payment_approval/static/description/images/payment-approval-03.png new file mode 100644 index 000000000..1aeabc29b Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-03.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-04.png b/account_payment_approval/static/description/images/payment-approval-04.png new file mode 100644 index 000000000..b6bdaea4c Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-04.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-05.png b/account_payment_approval/static/description/images/payment-approval-05.png new file mode 100644 index 000000000..ffbf6e5d5 Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-05.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-06.png b/account_payment_approval/static/description/images/payment-approval-06.png new file mode 100644 index 000000000..e78b05946 Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-06.png differ diff --git a/account_payment_approval/static/description/images/payment-approval-07.png b/account_payment_approval/static/description/images/payment-approval-07.png new file mode 100644 index 000000000..15f666a3e Binary files /dev/null and b/account_payment_approval/static/description/images/payment-approval-07.png differ diff --git a/account_payment_approval/static/description/index.html b/account_payment_approval/static/description/index.html new file mode 100644 index 000000000..b9bed0048 --- /dev/null +++ b/account_payment_approval/static/description/index.html @@ -0,0 +1,570 @@ +
+ cybrosys-logo
+
+
+
+

Payment Approval

+

Enables to use the approval feature in + customer and vendor payments. +

+
+

Key Highlights

+
    +
  • checkApproval stages in payments +
  • +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ This module helps the accounting department to have a control over the payments. + It enables payment approval feature in the payment transaction. +

+
+
+ +

Dynamic Product Fields

+
+
    +
  • + check + Approval stage in payment. +
  • +
  • + checkCan + Enable/disable payment approval from the settings. +
  • +
  • + checkCan + Approval feature can be applied based on the given amount. +
  • +
  • + checkCan + Currency wise amount specification. +
  • +
  • + checkCan + Quick access of the approval stages like Waiting For Approval, Approved, Rejected etc + from the filter window. +
  • + +
+
+ +
+
+

Screenshots

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

Suggested Products

+
+ +
+
+

Our Service

+
+ +
+
+
+

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.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please + let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+ \ No newline at end of file diff --git a/account_payment_approval/views/account_payment_view.xml b/account_payment_approval/views/account_payment_view.xml new file mode 100644 index 000000000..224729fef --- /dev/null +++ b/account_payment_approval/views/account_payment_view.xml @@ -0,0 +1,45 @@ + + + + account.payment.form.inherit + account.payment + + + +