diff --git a/invoice_multi_approval/README.rst b/invoice_multi_approval/README.rst new file mode 100644 index 000000000..601c13550 --- /dev/null +++ b/invoice_multi_approval/README.rst @@ -0,0 +1,40 @@ +Invoice multi level approval +============================ +* Enables the option for adding multiple approvals to the invoice documents + +Installation +============ +- www.odoo.com/documentation/13.0/setup/install.html +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: + Sayooj A O + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/invoice_multi_approval/__init__.py b/invoice_multi_approval/__init__.py new file mode 100644 index 000000000..2ac9ce16c --- /dev/null +++ b/invoice_multi_approval/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Sayooj A O() +# +# 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 models diff --git a/invoice_multi_approval/__manifest__.py b/invoice_multi_approval/__manifest__.py new file mode 100644 index 000000000..ced942bd2 --- /dev/null +++ b/invoice_multi_approval/__manifest__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Sayooj A O() +# +# 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 . +# +############################################################################# +{ + 'name': "Invoice Multi level Approval", + 'version': '13.0.1.0.0', + 'summary': """This module add the multiple approval option for invoice, + bill,refund and credit notes.""", + 'description': """This module add the multiple approval option for invoice, + bill,refund and credit notes.""", + 'category': 'Accounting', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['account'], + 'data': [ + 'data/data.xml', + 'security/groups.xml', + 'security/ir.model.access.csv', + 'views/invoice_approval_view.xml', + 'views/account_move_inherited.xml', + ], + 'license': "AGPL-3", + 'images': ['static/description/banner.png'], + 'installable': True, + 'application': True, +} diff --git a/invoice_multi_approval/data/data.xml b/invoice_multi_approval/data/data.xml new file mode 100644 index 000000000..6e2af647f --- /dev/null +++ b/invoice_multi_approval/data/data.xml @@ -0,0 +1,9 @@ + + + + + True + True + + + \ No newline at end of file diff --git a/invoice_multi_approval/doc/RELEASE_NOTES.md b/invoice_multi_approval/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..128739f58 --- /dev/null +++ b/invoice_multi_approval/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 14.02.2020 +#### Version 13.0.1.0.0 +##### ADD +- Initial commit diff --git a/invoice_multi_approval/models/__init__.py b/invoice_multi_approval/models/__init__.py new file mode 100644 index 000000000..3920246a8 --- /dev/null +++ b/invoice_multi_approval/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Sayooj A O() +# +# 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 account_move +from . import invoice_approval diff --git a/invoice_multi_approval/models/account_move.py b/invoice_multi_approval/models/account_move.py new file mode 100644 index 000000000..6a4999085 --- /dev/null +++ b/invoice_multi_approval/models/account_move.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Sayooj A O() +# +# 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 odoo import api, fields, models + + +class AccountMove(models.Model): + _inherit = 'account.move' + + approval_ids = fields.One2many('approval.line', 'move_id') + document_fully_approved = fields.Boolean(compute='_compute_document_fully_approved') + check_approve_ability = fields.Boolean(compute='_compute_check_approve_ability') + is_approved = fields.Boolean(compute='_compute_is_approved') + page_visibility = fields.Boolean(compute='_compute_page_visibility') + + @api.depends('approval_ids') + def _compute_page_visibility(self): + """Compute function for making the approval page visible/invisible""" + if self.approval_ids: + self.page_visibility = True + else: + self.page_visibility = False + + @api.onchange('partner_id') + def _onchange_partner_id(self): + """This is the onchange function of the partner which loads the + persons for the approval to the approver table of the account.move""" + res = super(AccountMove, self)._onchange_partner_id() + invoice_approval_id = self.env['invoice.approval'].search([]) + self.approval_ids = None + if invoice_approval_id.approve_customer_invoice and self.type == 'out_invoice': + for user in invoice_approval_id.invoice_approver_ids: + vals = { + 'approver_id': user.id + } + self.approval_ids |= self.approval_ids.new(vals) + elif invoice_approval_id.approve_vendor_bill and self.type == 'in_invoice': + for user in invoice_approval_id.bill_approver_ids: + vals = { + 'approver_id': user.id + } + self.approval_ids |= self.approval_ids.new(vals) + elif invoice_approval_id.approve_customer_credit and self.type == 'out_refund': + for user in invoice_approval_id.cust_credit_approver_ids: + vals = { + 'approver_id': user.id + } + self.approval_ids |= self.approval_ids.new(vals) + elif invoice_approval_id.approve_vendor_credit and self.type == 'in_refund': + for user in invoice_approval_id.vend_credit_approver_ids: + vals = { + 'approver_id': user.id + } + self.approval_ids |= self.approval_ids.new(vals) + return res + + @api.depends('approval_ids.approver_id') + def _compute_check_approve_ability(self): + """This is the compute function which check the current + logged in user is eligible or not for approving the document""" + current_user = self.env.uid + approvers_list = [] + for approver in self.approval_ids: + approvers_list.append(approver.approver_id.id) + if current_user in approvers_list: + self.check_approve_ability = True + else: + self.check_approve_ability = False + + def invoice_approve(self): + """This is the function of the approve button also + updates the approval table values according to the + approval of the users""" + self.ensure_one() + current_user = self.env.uid + for approval_id in self.approval_ids: + if current_user == approval_id.approver_id.id: + approval_id.update({'approval_status': True}) + + def _compute_is_approved(self): + """In this compute function we are verifying whether the document + is approved/not approved by the current logged in user""" + current_user = self.env.uid + if self.invoice_line_ids and self.approval_ids: + for approval_id in self.approval_ids: + if current_user == approval_id.approver_id.id: + if approval_id.approval_status: + self.is_approved = True + break + else: + self.is_approved = False + else: + self.is_approved = False + else: + self.is_approved = False + + @api.depends('approval_ids') + def _compute_document_fully_approved(self): + """This is the compute function which verifies whether + the document is completely approved or not""" + length_approval_ids = len(self.approval_ids) + approval_ids = self.approval_ids + approve_lines = approval_ids.filtered(lambda item: item.approval_status) + length_approve_lines = len(approve_lines) + if length_approval_ids == length_approve_lines: + self.document_fully_approved = True + else: + self.document_fully_approved = False + + +class ApprovalLine(models.Model): + _name = 'approval.line' + _description = 'Approval line in Move' + + move_id = fields.Many2one('account.move') + approver_id = fields.Many2one('res.users', string='Approver') + approval_status = fields.Boolean(string='Status') diff --git a/invoice_multi_approval/models/invoice_approval.py b/invoice_multi_approval/models/invoice_approval.py new file mode 100644 index 000000000..c467b0e9d --- /dev/null +++ b/invoice_multi_approval/models/invoice_approval.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Sayooj A O() +# +# 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 odoo import fields, models + + +class InvoiceApproval(models.Model): + _name = 'invoice.approval' + _rec_name = 'name' + _inherit = ['mail.thread', 'mail.activity.mixin'] + _description = 'Invoice Approval' + + name = fields.Char(default='Approval Configuration') + approve_customer_invoice = fields.Boolean(string="Approval on Customer Invoice", + help='Enable this field for adding the approvals for the customer invoice') + invoice_approver_ids = fields.Many2many('res.users', 'invoice_id', string='Invoice Approver', domain=lambda self: [ + ('groups_id', 'in', self.env.ref('invoice_multi_approval.group_approver').id)], + help='In this field you can add the approvers for the customer invoice') + approve_vendor_bill = fields.Boolean(string="Approval on Vendor Bill", + help='Enable this field for adding the approvals for the Vendor bill') + bill_approver_ids = fields.Many2many('res.users', 'bill_id', string='Bill Approver', domain=lambda self: [ + ('groups_id', 'in', self.env.ref('invoice_multi_approval.group_approver').id)], + help='In this field you can add the approvers for the Vendor bill') + approve_customer_credit = fields.Boolean(string='Approval on Customer Refund', + help='Enable this field for adding the approvals for the customer credit note') + cust_credit_approver_ids = fields.Many2many('res.users', 'cust_credit_id', string='Customer Credit Note Approver', + domain=lambda self: [ + ('groups_id', 'in', + self.env.ref('invoice_multi_approval.group_approver').id)], + help='In this field you can add the approvers for the Customer credit note') + approve_vendor_credit = fields.Boolean(string='Approval on Vendor Refund', + help='Enable this field for adding the approvals for the Vendor credit note') + vend_credit_approver_ids = fields.Many2many('res.users', 'vend_credit_id', string='Vendor Credit Note Approver', + domain=lambda self: [ + ('groups_id', 'in', + self.env.ref('invoice_multi_approval.group_approver').id)], + help='In this field you can add the approvers for the Vendor credit note') + + def apply_configuration(self): + """Function for applying the approval configuration""" + return True diff --git a/invoice_multi_approval/security/groups.xml b/invoice_multi_approval/security/groups.xml new file mode 100644 index 000000000..09e31e65d --- /dev/null +++ b/invoice_multi_approval/security/groups.xml @@ -0,0 +1,31 @@ + + + + + Invoice Approval + Access to the invoice approval menu + 3 + + + Approvers + + + + Approve Manager + + + + + Billing Administrator + + + + + Billing + + + + + \ No newline at end of file diff --git a/invoice_multi_approval/security/ir.model.access.csv b/invoice_multi_approval/security/ir.model.access.csv new file mode 100644 index 000000000..2f7d93c53 --- /dev/null +++ b/invoice_multi_approval/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +invoice_approval_access_right_user_id,invoice_approval_access_right_user,model_invoice_approval,invoice_multi_approval.group_approver,1,1,1,1 +invoice_approval_access_right_manager_id,invoice_approval_access_right_manager,model_invoice_approval,invoice_multi_approval.group_approve_manager,1,1,1,1 +approval_line_access_right_user_id,approval_line_access_right_user,model_approval_line,invoice_multi_approval.group_approver,1,1,1,1 +approval_line_access_right_manager_id,approval_line_access_right_manager,model_approval_line,invoice_multi_approval.group_approve_manager,1,1,1,1 +approval_line_access_right_group_user_id,approval_line_access_right_group_user,model_approval_line,base.group_user,1,0,0,0 +invoice_approval_access_right_group_user_id,invoice_approval_access_right_group_user,model_invoice_approval,base.group_user,1,0,0,0 diff --git a/invoice_multi_approval/static/description/banner.png b/invoice_multi_approval/static/description/banner.png new file mode 100644 index 000000000..84c305d21 Binary files /dev/null and b/invoice_multi_approval/static/description/banner.png differ diff --git a/invoice_multi_approval/static/description/icon.png b/invoice_multi_approval/static/description/icon.png new file mode 100644 index 000000000..2d48295c9 Binary files /dev/null and b/invoice_multi_approval/static/description/icon.png differ diff --git a/invoice_multi_approval/static/description/images/approval.png b/invoice_multi_approval/static/description/images/approval.png new file mode 100644 index 000000000..e7e8b363a Binary files /dev/null and b/invoice_multi_approval/static/description/images/approval.png differ diff --git a/invoice_multi_approval/static/description/images/banner_barcode_scanning.jpeg b/invoice_multi_approval/static/description/images/banner_barcode_scanning.jpeg new file mode 100644 index 000000000..529143e4e Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_barcode_scanning.jpeg differ diff --git a/invoice_multi_approval/static/description/images/banner_currency_total.png b/invoice_multi_approval/static/description/images/banner_currency_total.png new file mode 100644 index 000000000..6153ed719 Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_currency_total.png differ diff --git a/invoice_multi_approval/static/description/images/banner_customer_sequence.jpeg b/invoice_multi_approval/static/description/images/banner_customer_sequence.jpeg new file mode 100644 index 000000000..7451342d6 Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_customer_sequence.jpeg differ diff --git a/invoice_multi_approval/static/description/images/banner_previous_rates.jpeg b/invoice_multi_approval/static/description/images/banner_previous_rates.jpeg new file mode 100644 index 000000000..e10c28799 Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_previous_rates.jpeg differ diff --git a/invoice_multi_approval/static/description/images/banner_product_branding.png b/invoice_multi_approval/static/description/images/banner_product_branding.png new file mode 100644 index 000000000..aa12beabb Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_product_branding.png differ diff --git a/invoice_multi_approval/static/description/images/banner_product_expiry.jpeg b/invoice_multi_approval/static/description/images/banner_product_expiry.jpeg new file mode 100644 index 000000000..84a872d44 Binary files /dev/null and b/invoice_multi_approval/static/description/images/banner_product_expiry.jpeg differ diff --git a/invoice_multi_approval/static/description/images/checked.png b/invoice_multi_approval/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/invoice_multi_approval/static/description/images/checked.png differ diff --git a/invoice_multi_approval/static/description/images/cybrosys.png b/invoice_multi_approval/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/invoice_multi_approval/static/description/images/cybrosys.png differ diff --git a/invoice_multi_approval/static/description/images/invoice_approval_01.png b/invoice_multi_approval/static/description/images/invoice_approval_01.png new file mode 100644 index 000000000..d1957c2ee Binary files /dev/null and b/invoice_multi_approval/static/description/images/invoice_approval_01.png differ diff --git a/invoice_multi_approval/static/description/images/invoice_approval_02.png b/invoice_multi_approval/static/description/images/invoice_approval_02.png new file mode 100644 index 000000000..113211795 Binary files /dev/null and b/invoice_multi_approval/static/description/images/invoice_approval_02.png differ diff --git a/invoice_multi_approval/static/description/images/invoice_approval_03.png b/invoice_multi_approval/static/description/images/invoice_approval_03.png new file mode 100644 index 000000000..42a656803 Binary files /dev/null and b/invoice_multi_approval/static/description/images/invoice_approval_03.png differ diff --git a/invoice_multi_approval/static/description/images/invoice_approval_04.png b/invoice_multi_approval/static/description/images/invoice_approval_04.png new file mode 100644 index 000000000..348892aeb Binary files /dev/null and b/invoice_multi_approval/static/description/images/invoice_approval_04.png differ diff --git a/invoice_multi_approval/static/description/images/invoice_approval_05.png b/invoice_multi_approval/static/description/images/invoice_approval_05.png new file mode 100644 index 000000000..6c1519834 Binary files /dev/null and b/invoice_multi_approval/static/description/images/invoice_approval_05.png differ diff --git a/invoice_multi_approval/static/description/index.html b/invoice_multi_approval/static/description/index.html new file mode 100644 index 000000000..2471860bb --- /dev/null +++ b/invoice_multi_approval/static/description/index.html @@ -0,0 +1,542 @@ +
+ cybrosys-logo
+
+
+
+

Invoice Multi Level Approval

+

Module add the multiple approval option for + invoice,bill,refund and credit notes.

+
+

Key Highlights

+
    +
  • checkConfiguration + panel for approval settings. +
  • +
  • checkDocument can + only validate when all approvals are completed. +
  • +
  • checkApproval + Option can be enabled/disabled from the configuration panel. +
  • +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ The module allows to assign the users for the approval process in the invoice documents and + the document can be posted only after the approval process completed. +

+
+
+ +

Configuration panel for approval + settings.

+
+
    +
  • + checkAdd + salesperson's signature in Sales documents. +
  • +
  • + checkDocument + can only validate when all approvals are completed. +
  • +
  • + checkApproval + Option can be enabled/disabled from the configuration panel. +
  • +
+
+ +
+
+

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/invoice_multi_approval/views/account_move_inherited.xml b/invoice_multi_approval/views/account_move_inherited.xml new file mode 100644 index 000000000..740c1eca5 --- /dev/null +++ b/invoice_multi_approval/views/account_move_inherited.xml @@ -0,0 +1,43 @@ + + + + account.move.approval.inherited + account.move + + + + + + + + + +