@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Sales Order Double Approval |
|||
=========================== |
|||
This module helps to set two separate approvals process for a sale order to ensure accuracy and compliance. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, v3.0 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers : (V15) Mufeeda P P, |
|||
(V16) Ajith V, |
|||
(V17) Ajith V, |
|||
(V18) Aysha Shalin |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://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 |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import models |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Sales Order Double Approval', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Sales', |
|||
'summary': """This module helps to set two separate approvals process for a |
|||
sale order to ensure accuracy and compliance.""", |
|||
'description': """This module enables a process where a sale order must be |
|||
reviewed and approved by two separate individuals or departments before it |
|||
is finalized. This is implemented to ensure accuracy, compliance, and |
|||
reduce the risk of errors and fraud in sales transactions. """, |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com/', |
|||
'depends': ['base', 'sale_management'], |
|||
'data': [ |
|||
'views/res_company_views.xml', |
|||
'views/res_config_settings_views.xml', |
|||
'views/sale_order_views.xml' |
|||
], |
|||
'images': [ |
|||
'static/description/banner.jpg', |
|||
], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <sales_order_double_approval> |
|||
|
|||
#### 02.01.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Sales Order Double Approval |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import res_company |
|||
from . import res_config_settings |
|||
from . import sale_order |
@ -0,0 +1,33 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResCompany(models.Model): |
|||
""" Inheriting res.company model to add custom field """ |
|||
_inherit = 'res.company' |
|||
|
|||
so_double_validation = fields.Boolean( |
|||
string="Sale Order Approval", |
|||
help="Enable this option to require double validation for sale orders. " |
|||
"When enabled, sale orders exceeding a specified minimum amount " |
|||
"will require approval by a sales manager.") |
@ -0,0 +1,63 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
""" Inheriting the settings to add custom fields """ |
|||
_inherit = 'res.config.settings' |
|||
|
|||
so_approval = fields.Boolean( |
|||
string="Sale Order Approval", |
|||
help="Enable this option to require double validation for sale orders. " |
|||
"When enabled, sale orders exceeding the specified minimum amount " |
|||
"will require approval by a sales manager." |
|||
) |
|||
so_min_amount = fields.Monetary( |
|||
string="Minimum Amount", |
|||
help="Specify the minimum amount that triggers the double validation " |
|||
"for sale orders. Sale orders exceeding this amount will require " |
|||
"approval by a sales manager." |
|||
) |
|||
|
|||
@api.model |
|||
def get_values(self): |
|||
""" Override to get the values of the custom fields from the |
|||
'ir.config_parameter' model. """ |
|||
res = super(ResConfigSettings, self).get_values() |
|||
res['so_approval'] = self.env['ir.config_parameter'].sudo().get_param( |
|||
"sales_order_double_approval.so_approval", default="") |
|||
res['so_min_amount'] = self.env['ir.config_parameter'].sudo().get_param( |
|||
"sales_order_double_approval.so_min_amount", default="") |
|||
return res |
|||
|
|||
@api.model |
|||
def set_values(self): |
|||
""" Override to set the values of the custom fields in the |
|||
'ir.config_parameter' model. """ |
|||
self.env['ir.config_parameter'].set_param( |
|||
"sales_order_double_approval.so_approval", |
|||
self.so_approval or '') |
|||
self.env['ir.config_parameter'].set_param( |
|||
"sales_order_double_approval.so_min_amount", |
|||
self.so_min_amount or '') |
|||
super(ResConfigSettings, self).set_values() |
@ -0,0 +1,56 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
""" Inheriting sale.order to add new state """ |
|||
_inherit = 'sale.order' |
|||
|
|||
state = fields.Selection(selection_add= |
|||
[('to_approve', 'To Approve'), |
|||
('sent',)], ondelete={'to_approve': 'cascade'}) |
|||
|
|||
def button_approve(self): |
|||
""" Method to approve the sale order and change its state to 'sale' """ |
|||
self.write({'state': 'sale'}) |
|||
|
|||
def action_confirm(self): |
|||
""" Override to add double validation logic based on company settings. |
|||
Confirms the sale order if conditions are met, otherwise sets state to |
|||
'to_approve'. """ |
|||
res = super(SaleOrder, self).action_confirm() |
|||
if self.company_id.so_double_validation: |
|||
if self.env['ir.config_parameter'].sudo().get_param( |
|||
'sales_order_double_approval.so_approval'): |
|||
if self.amount_total > float( |
|||
self.env['ir.config_parameter'].sudo().get_param( |
|||
'sales_order_double_approval.so_min_amount')): |
|||
if self.env.user.has_group('sales_team.group_sale_manager'): |
|||
self.state = 'sale' |
|||
else: |
|||
self.state = 'to_approve' |
|||
return res |
|||
|
|||
def action_cancel(self): |
|||
""" Method to cancel the sale order and change state into 'cancel' """ |
|||
self.state = 'cancel' |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 225 KiB |
After Width: | Height: | Size: 747 KiB |
After Width: | Height: | Size: 41 KiB |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- It adds a new field 'so_double_validation' after the 'favicon' field. |
|||
This is used to enable double validation for sale orders within the company settings. --> |
|||
<record id="view_company_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
res.company.form.view.inherit.sales.order.double.approval |
|||
</field> |
|||
<field name="model">res.company</field> |
|||
<field name="inherit_id" ref="base.view_company_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='color']" position="after"> |
|||
<field name="so_double_validation"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,30 @@ |
|||
<odoo> |
|||
<!-- It adds a section for Sale Order Approval settings, allowing users to configure whether sale orders |
|||
require manager approval above a certain minimum amount. --> |
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
res.config.settings.form.view.inherit.sales.order.double.approval |
|||
</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="inherit_id" ref="base.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//app[@name='sale_management']//block[@id='pricing_setting_container']" |
|||
position="after"> |
|||
<block title="Sale Order Approval" |
|||
id="sale_order_approval_setting_container"> |
|||
<setting id="so_approval" help="Request managers to approve orders above a |
|||
minimum amount"> |
|||
<field name="so_approval"/> |
|||
<div class="content-group" invisible="not so_approval"> |
|||
<div class="mt16"> |
|||
<label for="so_min_amount"/> |
|||
<field name="so_min_amount" |
|||
style="margin-left: 10px;"/> |
|||
</div> |
|||
</div> |
|||
</setting> |
|||
</block> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- It adds 'Approve' and 'Cancel' buttons next to the 'Send by Email' button in the sale |
|||
order form. These buttons are intended for use by sales managers to approve or cancel sale orders. --> |
|||
<record id="view_order_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
sale.order.form.view.inherit.sales.order.double.approval |
|||
</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" ref="sale.view_order_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//button[@name='action_quotation_send']" |
|||
position="after"> |
|||
<button name="button_approve" string="Approve" |
|||
class="oe_highlight" type="object" |
|||
invisible="state not in 'to_approve'" |
|||
groups="sales_team.group_sale_manager"/> |
|||
<button name="action_cancel" string="Cancel" |
|||
class="oe_highlight" type="object" |
|||
invisible="state not in 'to_approve'" |
|||
groups="sales_team.group_sale_manager"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |