@ -0,0 +1,43 @@ |
|||
.. image:: https://img.shields.io/badge/license-OPL--1-red.svg |
|||
:target: https://www.odoo.com/documentation/17.0/legal/licenses.html#odoo-apps |
|||
:alt: License: OPL-1" |
|||
|
|||
Sale Approval Connector |
|||
======================= |
|||
Helps to Setting up a Approval system for sale orders |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed. |
|||
|
|||
License |
|||
======= |
|||
Odoo Proprietary License v1.0 (OPL-1) |
|||
(https://www.odoo.com/documentation/17.0/legal/licenses.html#odoo-apps) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V18) AFRA MP, |
|||
(V17) VISHNU KP, |
|||
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 |
|||
========== |
|||
.. 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,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
from . import models |
@ -0,0 +1,43 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': "Sale Approval Connector", |
|||
'version': "1.0", |
|||
'category': 'Sales', |
|||
'summary': """Setting up a system where all sale orders must be approved at |
|||
a higher level before they can be processed or fulfilled.""", |
|||
'description': """This process ensures that orders are reviewed and |
|||
approved by designated users before they are confirmed and processed.""", |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': "Cybrosys Techno Solutions", |
|||
'maintainer': "Cybrosys Techno Solutions", |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['sale_management', 'approvals'], |
|||
'data': ['data/approval_connector_data.xml', |
|||
'views/approval_category_views.xml', |
|||
'views/sale_order_views.xml', |
|||
'views/approval_request_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'OPL-1', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<record id="approval_category_data_sale" model="approval.category"> |
|||
<field name="name">Create Sale Request</field> |
|||
<field name="approval_type">sale</field> |
|||
<field name="sequence">90</field> |
|||
<field name="has_product">required</field> |
|||
<field name="has_quantity">required</field> |
|||
<field name="automated_sequence" eval="True"/> |
|||
<field name="sequence_code">SAL</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <approval_connector> |
|||
#### 29.01.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
|
|||
- Initial Commit for Sale Approval Connector |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
from . import approval_category |
|||
from . import approval_request |
|||
from . import sale_order |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ApprovalCategory(models.Model): |
|||
_inherit = 'approval.category' |
|||
"""Class inherited for the category associated with approval category |
|||
also add some additional fields""" |
|||
|
|||
approval_type = fields.Selection(selection_add=[ |
|||
('purchase', "Create RFQ's"), ('sale', 'Sale'), ], |
|||
string="Approval Type", |
|||
ondelete={'sale': 'cascade',}, |
|||
help="Approval type to identify the model") |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models, _ |
|||
|
|||
|
|||
class ApprovalRequest(models.Model): |
|||
_inherit = 'approval.request' |
|||
|
|||
"""Class inherit for the approval request button in the form""" |
|||
|
|||
order_id = fields.Many2one('sale.order', string='Document', |
|||
help="Connection id for the sale order") |
|||
|
|||
|
|||
def action_approve(self, approver=None): |
|||
"""This method is used to confirm the order Approval""" |
|||
res = super(ApprovalRequest, self).action_approve(approver) |
|||
for order in [self.order_id]: |
|||
approve_status = self.approver_ids.mapped('status') |
|||
if all(status == 'approved' for status in approve_status) and order: |
|||
order.write({'state': 'approved', 'is_approved': True}) |
|||
order.message_post( |
|||
body=_('Requested approval is Confirmed'), |
|||
message_type='comment') |
|||
return res |
|||
|
|||
def action_refuse(self, approver=None): |
|||
"""This method is used to reject the approval request""" |
|||
res = super().action_refuse(approver) |
|||
if self.order_id: |
|||
self.order_id._action_cancel() |
|||
return res |
@ -0,0 +1,54 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: AFRA MP (odoo@cybrosys.com) |
|||
# |
|||
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies of the |
|||
# Software or modified copies of the Software. |
|||
# |
|||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
|||
# USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models, _ |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
_inherit = 'sale.order' |
|||
"""Class inherited for adding extra fields and methods""" |
|||
state = fields.Selection( |
|||
selection_add=[('approve', 'To Approve'), ('approved', 'Approved'), |
|||
('sale',), ]) |
|||
is_approved = fields.Boolean(string='Approved', default=False) |
|||
|
|||
def _can_be_confirmed(self): |
|||
"""This function is used to check the state of the order""" |
|||
self.ensure_one() |
|||
return self.state in {'draft', 'sent', 'approved'} |
|||
|
|||
def action_confirm(self): |
|||
"""Method is used to confirm the order""" |
|||
approval = self.env['approval.category'].search([('approval_type', '=', 'sale')]) |
|||
if approval and not self.is_approved: |
|||
self.env['approval.request'].create({ |
|||
'name': self.name, |
|||
'request_owner_id': self.user_id.id, |
|||
'category_id': approval.id, |
|||
'date_start': fields.Datetime.now(), |
|||
'date_end': fields.Datetime.now(), |
|||
'order_id': self.id, |
|||
}).action_confirm() |
|||
self.message_post(body=self.env.user.name + _( |
|||
' Created a request for approval for ') + self.name, |
|||
message_type='comment') |
|||
self.write({'state': 'approve'}) |
|||
else: |
|||
self.write({'state': 'draft'}) |
|||
return super().action_confirm() |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
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: 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: 47 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 160 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 187 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 157 KiB |
After Width: | Height: | Size: 937 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 11 KiB |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- To add the approval type in approval category--> |
|||
<record id="approval_category_view_form" model="ir.ui.view"> |
|||
<field name="name">approval.category.view.form.inherit.approval.connector</field> |
|||
<field name="model">approval.category</field> |
|||
<field name="inherit_id" ref="approvals.approval_category_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='approval_type']" position="attributes"> |
|||
<attribute name="invisible">0</attribute> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<record id="approval_request_view_form" model="ir.ui.view"> |
|||
<field name="name">approval.request.view.form.inherit.approval.connector</field> |
|||
<field name="model">approval.request</field> |
|||
<field name="inherit_id" ref="approvals.approval_request_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="request_owner_id" position="before"> |
|||
<field name="order_id" readonly="1"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- To add the additional state and fields to the sale order--> |
|||
<record id="view_order_form" model="ir.ui.view"> |
|||
<field name="name">sale.order.view.form.inherit.approval.connector</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" ref="sale.view_order_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='state']" position="replace"> |
|||
<field name="state" widget="statusbar" statusbar_visible="draft,sent"/> |
|||
</xpath> |
|||
<xpath expr="//button[@name='action_preview_sale_order']" position="before"> |
|||
<button name="action_confirm" id="action_confirm" data-hotkey="q" |
|||
string="Confirm" class="btn-primary" type="object" context="{'validate_analytic': True}" |
|||
invisible="state not in ['approved']"/> |
|||
<field name="is_approved" invisible="1"/> |
|||
</xpath> |
|||
<xpath expr="//button[@name='action_cancel']" position="attributes"> |
|||
<attribute name="invisible">state not in ['draft', 'sent', 'sale','approved'] or not id</attribute> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |