Skip to content

Commit 3d8b2e9

Browse files
committed
[16.0][ADD] sale_partner_sale_contact_on_project: Propagate sale contact to projects
This module extends sale_partner_sale_contact to automatically propagate the sale contact from sale orders to the projects created from those orders. Features: * Propagate sale contact from sale order to project * Display sale contact field on project form view * Automatic propagation when project is created from sale order line Technical implementation: * Override _timesheet_create_project_prepare_values on sale.order.line * Add sale_contact_partner_id field on project.project * Tree and form view customization for projects * French translations included Depends on: sale_partner_sale_contact (in this PR)
1 parent 0fb37f3 commit 3d8b2e9

File tree

17 files changed

+881
-0
lines changed

17 files changed

+881
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
====================================
2+
Sale Partner Sale Contact on Project
3+
====================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:187ed00353d0a2a7c976b79b9636089dff2c562c748f2e442780b86e742ccff7
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_partner_sale_contact_on_project
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_partner_sale_contact_on_project
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends **Sale Partner Sale Contact** to propagate the sale contact field to projects.
32+
33+
When a sale order with a sale contact creates a project (via service products), the contact person is automatically propagated to the project.
34+
35+
This allows you to:
36+
37+
* Track the contact person for each project
38+
* Maintain consistency between sale orders and related projects
39+
* Display the sale contact on project forms
40+
41+
**Table of contents**
42+
43+
.. contents::
44+
:local:
45+
46+
Usage
47+
=====
48+
49+
To use this module:
50+
51+
#. Install both **Sale Partner Sale Contact** and **Sale Partner Sale Contact on Project**
52+
#. Create a sale order with a customer that has child contacts
53+
#. Select a **Sale Contact** from the customer's child contacts
54+
#. Add a service product configured to create a project or task
55+
#. Confirm the sale order
56+
#. The created project will automatically have the same sale contact
57+
#. You can also manually set or change the sale contact on any project form
58+
59+
The sale contact field is visible on the project form, right after the customer field.
60+
61+
Bug Tracker
62+
===========
63+
64+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
65+
In case of trouble, please check there if your issue has already been reported.
66+
If you spotted it first, help us to smash it by providing a detailed and welcomed
67+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_partner_sale_contact_on_project%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
68+
69+
Do not contact contributors directly about support or help with technical issues.
70+
71+
Credits
72+
=======
73+
74+
Authors
75+
~~~~~~~
76+
77+
* OpenStudio SAS
78+
79+
Contributors
80+
~~~~~~~~~~~~
81+
82+
* Simon Maillard (maisim) <[email protected]>
83+
84+
Maintainers
85+
~~~~~~~~~~~
86+
87+
This module is maintained by the OCA.
88+
89+
.. image:: https://odoo-community.org/logo.png
90+
:alt: Odoo Community Association
91+
:target: https://odoo-community.org
92+
93+
OCA, or the Odoo Community Association, is a nonprofit organization whose
94+
mission is to support the collaborative development of Odoo features and
95+
promote its widespread use.
96+
97+
.. |maintainer-maisim| image:: https://github.com/maisim.png?size=40px
98+
:target: https://github.com/maisim
99+
:alt: maisim
100+
101+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
102+
103+
|maintainer-maisim|
104+
105+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_partner_sale_contact_on_project>`_ project on GitHub.
106+
107+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Odoo Community Association (OCA)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import models
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2025 Odoo Community Association (OCA)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Sale Partner Sale Contact on Project",
6+
"summary": "Propagate sale contact from sale orders to projects",
7+
"version": "16.0.1.0.0",
8+
"category": "Sales Management",
9+
"website": "https://github.com/OCA/sale-workflow",
10+
"author": "OpenStudio SAS, Odoo Community Association (OCA)",
11+
"maintainers": ["maisim"],
12+
"license": "AGPL-3",
13+
"application": False,
14+
"installable": True,
15+
"depends": [
16+
"sale_partner_sale_contact",
17+
"sale_project",
18+
],
19+
"data": [
20+
"views/project_project_views.xml",
21+
],
22+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_partner_sale_contact_on_project
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: Automatically generated\n"
10+
"Language-Team: none\n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: 8bit\n"
14+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
15+
"Language: fr\n"
16+
17+
#. module: sale_partner_sale_contact_on_project
18+
#: model:ir.model.fields,field_description:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
19+
msgid "Sale Contact"
20+
msgstr "Contact Commercial"
21+
22+
#. module: sale_partner_sale_contact_on_project
23+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_project_project
24+
msgid "Project"
25+
msgstr "Projet"
26+
27+
#. module: sale_partner_sale_contact_on_project
28+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order
29+
msgid "Sales Order"
30+
msgstr "Bon de commande"
31+
32+
#. module: sale_partner_sale_contact_on_project
33+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order_line
34+
msgid "Sales Order Line"
35+
msgstr "Ligne de vente"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_partner_sale_contact_on_project
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_partner_sale_contact_on_project
17+
#: model:ir.model.fields,field_description:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
18+
msgid "Sale Contact"
19+
msgstr ""
20+
21+
#. module: sale_partner_sale_contact_on_project
22+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_project_project
23+
msgid "Project"
24+
msgstr ""
25+
26+
#. module: sale_partner_sale_contact_on_project
27+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order
28+
msgid "Sales Order"
29+
msgstr ""
30+
31+
#. module: sale_partner_sale_contact_on_project
32+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order_line
33+
msgid "Sales Order Line"
34+
msgstr ""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 Odoo Community Association (OCA)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import sale_order_line
5+
from . import project_project
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Odoo Community Association (OCA)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ProjectProject(models.Model):
8+
_inherit = "project.project"
9+
10+
sale_contact_partner_id = fields.Many2one(
11+
comodel_name="res.partner",
12+
string="Sale Contact",
13+
domain=(
14+
"[('id', 'child_of', partner_id), "
15+
"('is_company', '=', False), ('id', '!=', partner_id)]"
16+
),
17+
help="Contact person for this project from the sale order. "
18+
"Only child contacts of the customer can be selected.",
19+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2025 Odoo Community Association (OCA)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
def _timesheet_create_project_prepare_values(self):
11+
"""Add sale contact to project values."""
12+
values = super()._timesheet_create_project_prepare_values()
13+
if self.order_id.sale_contact_partner_id:
14+
values["sale_contact_partner_id"] = self.order_id.sale_contact_partner_id.id
15+
return values
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Simon Maillard (maisim) <[email protected]>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This module extends **Sale Partner Sale Contact** to propagate the sale contact field to projects.
2+
3+
When a sale order with a sale contact creates a project (via service products), the contact person is automatically propagated to the project.
4+
5+
This allows you to:
6+
7+
* Track the contact person for each project
8+
* Maintain consistency between sale orders and related projects
9+
* Display the sale contact on project forms

0 commit comments

Comments
 (0)