Skip to content

Commit

Permalink
[ADD] sale_order_commercial_copy_false: copy = false in commercial fi…
Browse files Browse the repository at this point in the history
…elds
  • Loading branch information
unaiberis authored and anajuaristi committed Sep 9, 2024
1 parent ca269fc commit fb5d8b6
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 0 deletions.
75 changes: 75 additions & 0 deletions sale_order_commercial_copy_false/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

================================
Sale Order Commercial Copy False
================================

Overview
========

The **Sale Order Commercial Copy False** module modifies the behavior of duplicate sale orders by ensuring that certain fields related to the commercial partner are not copied to the new order. This helps maintain data integrity and avoids unnecessary duplication of sensitive information.

Features
========

- **Sale Order**:

- The `user_id` field is not copied when duplicating a sale order.

- **Sale Order Line**:

- The `salesman_id` field is not copied when duplicating a sale order line.

Usage
=====

After installing the module, the following changes will be applied:

- **Sale Orders**:

- When duplicating a sale order, the `user_id` field will not be copied to the new order.

- **Sale Order Lines**:

- When duplicating a sale order line, the `salesman_id` field will not be copied to the new line.

Configuration
=============

No additional configuration is required. The module works out of the box once installed.

Testing
=======

The module has been designed with the following functionalities in mind:

- **Duplication of Sale Orders**:

- Test the duplication of sale orders to ensure that the `user_id` field is not copied to the new order.

- **Duplication of Sale Order Lines**:

- Test the duplication of sale order lines to ensure that the `salesman_id` field is not copied to the new line.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/avanzosc/sale-addons/issues>`_. Please check there for existing issues or to report new ones.

Credits
=======

Contributors
------------

* Unai Beristain <[email protected]>

* Ana Juaristi <[email protected]>

Do not contact contributors directly about support or help with technical issues.

License
=======
This project is licensed under the AGPL-3 License. For more details, please refer to the LICENSE file or visit <http://www.gnu.org/licenses/agpl-3.0-standalone.html>.
1 change: 1 addition & 0 deletions sale_order_commercial_copy_false/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions sale_order_commercial_copy_false/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "Sale Order Commercial Copy False",
"version": "14.0.1.0.0",
"category": "Sales",
"summary": "Make commercial partner ID fields not copied on sale order duplicate",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/sale-addons",
"license": "AGPL-3",
"depends": ["sale"],
"data": [],
"installable": True,
"application": False,
}
2 changes: 2 additions & 0 deletions sale_order_commercial_copy_false/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order
from . import sale_order_line
10 changes: 10 additions & 0 deletions sale_order_commercial_copy_false/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

user_id = fields.Many2one(
"res.users",
copy=False,
)
10 changes: 10 additions & 0 deletions sale_order_commercial_copy_false/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

salesman_id = fields.Many2one(
"res.users",
copy=False,
)
6 changes: 6 additions & 0 deletions setup/sale_order_commercial_copy_false/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit fb5d8b6

Please sign in to comment.