@ -0,0 +1,50 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Sale Order Versions |
||||
|
=================== |
||||
|
This module allow to create versions of a sale order. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
- Additional configuration not required |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (AGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
Developers: |
||||
|
(V16) Ammu Raj @cybrosys, |
||||
|
(V17) Safa Faheem @cybrosys |
||||
|
(V18) Ashwin T @cybrosys |
||||
|
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: Cybrosys Techno Solutions (Contact : 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,42 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (Contact : 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': 'Sale Order Versions', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Sales', |
||||
|
'summary': 'For creating multiple sale order versions', |
||||
|
'description': """This module will help to creating multiple sale order |
||||
|
versions and confirming the version as needed.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['base', 'sale_management'], |
||||
|
'data': [ |
||||
|
'views/sale_order_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
## Module <versioning_in_sale_order> |
||||
|
|
||||
|
#### 26.05.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for Sale Order Versions |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (Contact : 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 sale_order |
@ -0,0 +1,106 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################ |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (Contact : 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 SaleOrder(models.Model): |
||||
|
"""This class inherits the model sale order for adding fields and functions |
||||
|
for versioning.""" |
||||
|
_inherit = "sale.order" |
||||
|
|
||||
|
is_version = fields.Boolean(string="Is Version", |
||||
|
help="For checking version or not") |
||||
|
|
||||
|
version_count = fields.Integer(string="Sale Version Count", |
||||
|
compute='_compute_version_ids', |
||||
|
help="Count of version created") |
||||
|
current_version_id = fields.Many2one("sale.order", |
||||
|
help="For creating versions") |
||||
|
version_ids = fields.One2many("sale.order", |
||||
|
inverse_name="current_version_id", |
||||
|
help="Versions created") |
||||
|
|
||||
|
def action_create_versions(self): |
||||
|
"""For creating the versions of the sale order""" |
||||
|
sale_order_copy_id = self.copy() |
||||
|
sale_order_copy_id.is_version = True |
||||
|
length = len(self.version_ids) |
||||
|
sale_order_copy_id.name = "%s-%s" % (self.name, str(length + 1)) |
||||
|
order_lines = [] |
||||
|
val = (0, 0, { |
||||
|
'display_type': 'line_note', |
||||
|
'name': 'This is version %s ' %(str(length + 1)), |
||||
|
'product_id': False, |
||||
|
'product_uom_qty': 0, |
||||
|
'product_uom': False, |
||||
|
'price_unit': 0, |
||||
|
'order_id': sale_order_copy_id.id, |
||||
|
'tax_id': False, |
||||
|
}) |
||||
|
order_lines.append(val) |
||||
|
sale_order_copy_id.update({'order_line': order_lines}) |
||||
|
|
||||
|
self.write({'version_ids': [(4, sale_order_copy_id.id)]}) |
||||
|
|
||||
|
@api.depends('version_ids') |
||||
|
def _compute_version_ids(self): |
||||
|
"""For calculating the number of versions created""" |
||||
|
for sale in self: |
||||
|
sale.version_count = len(sale.version_ids) |
||||
|
|
||||
|
def action_view_versions(self): |
||||
|
"""action for viewing versions""" |
||||
|
action = { |
||||
|
"type": "ir.actions.act_window", |
||||
|
"view_mode": "kanban,list,form", |
||||
|
"name": _("Sale Order Versions"), |
||||
|
"res_model": self._name, |
||||
|
"domain": [('id', 'in', self.version_ids.ids)], |
||||
|
"target": "current", |
||||
|
} |
||||
|
return action |
||||
|
|
||||
|
def action_confirm(self): |
||||
|
"""Override the confirm button of the sale order for cancelling the |
||||
|
other versions and making the current version main""" |
||||
|
res = super().action_confirm() |
||||
|
if not self.version_ids: |
||||
|
parent_sale = self.current_version_id |
||||
|
versions = parent_sale.mapped('version_ids').mapped('id') |
||||
|
if versions: |
||||
|
versions.append(parent_sale.id) |
||||
|
for version in parent_sale.version_ids: |
||||
|
if version.state == 'sale': |
||||
|
# Updating the version name into main version name and |
||||
|
# other versions state into cancel |
||||
|
version.current_version_id.update({'is_version': True, |
||||
|
'state': 'cancel'}) |
||||
|
version.update({'version_ids': versions, |
||||
|
"name": version.current_version_id.name, |
||||
|
'is_version': False}) |
||||
|
if version.state == 'draft': |
||||
|
version.update({'state': 'cancel'}) |
||||
|
else: |
||||
|
if self.state == 'sale': |
||||
|
for sale in self.version_ids: |
||||
|
sale.update({'state': 'cancel'}) |
||||
|
return res |
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: 228 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: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 788 KiB |
After Width: | Height: | Size: 46 KiB |
@ -0,0 +1,39 @@ |
|||||
|
<?xml version="1.0"?> |
||||
|
<odoo> |
||||
|
<!-- view of inheriting sale order for adding fields, button and smart button for versions--> |
||||
|
<record id="view_order_form" model="ir.ui.view"> |
||||
|
<field name="name">sale.order.view.form.inherit.versioning.in.sale.order</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_confirm']" position="after"> |
||||
|
<button name="action_create_versions" invisible="state in ['draft','sale', 'cancel'] or is_version" |
||||
|
type="object" |
||||
|
string="Create Version"/> |
||||
|
</xpath> |
||||
|
<div class="oe_button_box" name="button_box"> |
||||
|
<button name="action_view_versions" |
||||
|
type="object" |
||||
|
class="oe_stat_button" |
||||
|
icon="fa-bars" |
||||
|
invisible="version_count == 0"> |
||||
|
<field name="version_count" widget="statinfo" |
||||
|
string="Versions"/> |
||||
|
</button> |
||||
|
</div> |
||||
|
<xpath expr="//field[@name='validity_date']" position="after"> |
||||
|
<field name="is_version" invisible="1"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//button[@name='action_draft']" position='attributes'> |
||||
|
<attribute name="invisible">state not in ['cancel'] or is_version |
||||
|
</attribute> |
||||
|
<attribute name="states"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
<!--Domain passed for only viewing the confirmed version--> |
||||
|
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window"> |
||||
|
<field name="domain">[('is_version', '=', False)]</field> |
||||
|
</record> |
||||
|
</odoo> |