Skip to content

Commit ea7df6b

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 6cae565 commit ea7df6b

File tree

17 files changed

+951
-0
lines changed

17 files changed

+951
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
====================================
6+
Sale Partner Sale Contact on Project
7+
====================================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:187ed00353d0a2a7c976b79b9636089dff2c562c748f2e442780b86e742ccff7
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
22+
:alt: License: LGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
24+
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_partner_sale_contact_on_project
25+
:alt: OCA/sale-workflow
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_partner_sale_contact_on_project
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
This module extends **Sale Partner Sale Contact** to propagate the sale contact field to projects.
36+
37+
When a sale order with a sale contact creates a project (via service products),
38+
the contact person is automatically propagated to the project. This ensures the
39+
same named commercial contact (procurement manager, project lead, etc.) visible
40+
on the sale order and its invoices is also recorded on the resulting project,
41+
without affecting project or task addresses.
42+
43+
This allows you to:
44+
45+
* Track the contact person for each project
46+
* Maintain consistency between sale orders and related projects
47+
* Display the sale contact on project forms
48+
49+
**Table of contents**
50+
51+
.. contents::
52+
:local:
53+
54+
Usage
55+
=====
56+
57+
To use this module:
58+
59+
#. Install both **Sale Partner Sale Contact** and **Sale Partner Sale Contact on Project**
60+
#. Create a sale order with a customer that has child contacts
61+
#. Select a **Sale Contact** from the customer's child contacts
62+
#. Add a service product configured to create a project or task
63+
#. Confirm the sale order
64+
#. The created project will automatically have the same sale contact
65+
#. You can also manually set or change the sale contact on any project form
66+
67+
The sale contact field is visible on the project form, right after the customer field.
68+
69+
**Auto-switch behavior**: If you select a contact person in the customer field and that person has a parent company, the system will automatically:
70+
71+
* Set the customer field to the parent company
72+
* Set the sale contact field to the person you selected
73+
74+
This behavior only applies when the restriction modules (\*_partner_id_company_only) are not installed.
75+
76+
Bug Tracker
77+
===========
78+
79+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
80+
In case of trouble, please check there if your issue has already been reported.
81+
If you spotted it first, help us to smash it by providing a detailed and welcomed
82+
`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**>`_.
83+
84+
Do not contact contributors directly about support or help with technical issues.
85+
86+
Credits
87+
=======
88+
89+
Authors
90+
~~~~~~~
91+
92+
* OpenStudio SAS
93+
94+
Contributors
95+
~~~~~~~~~~~~
96+
97+
* Simon Maillard (maisim) <simon@ogesta.fr>
98+
99+
Maintainers
100+
~~~~~~~~~~~
101+
102+
This module is maintained by the OCA.
103+
104+
.. image:: https://odoo-community.org/logo.png
105+
:alt: Odoo Community Association
106+
:target: https://odoo-community.org
107+
108+
OCA, or the Odoo Community Association, is a nonprofit organization whose
109+
mission is to support the collaborative development of Odoo features and
110+
promote its widespread use.
111+
112+
.. |maintainer-maisim| image:: https://github.com/maisim.png?size=40px
113+
:target: https://github.com/maisim
114+
:alt: maisim
115+
116+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
117+
118+
|maintainer-maisim|
119+
120+
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.
121+
122+
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 2026 OpenStudio SAS
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
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 2026 OpenStudio SAS
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
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": "LGPL-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
"Language: fr\n"
12+
"MIME-Version: 1.0\n"
13+
"Content-Type: text/plain; charset=UTF-8\n"
14+
"Content-Transfer-Encoding: 8bit\n"
15+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
16+
17+
#. module: sale_partner_sale_contact_on_project
18+
#: model:ir.model.fields,help:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
19+
msgid ""
20+
"Contact person for this project from the sale order. Only child contacts of "
21+
"the customer can be selected."
22+
msgstr ""
23+
"Personne de contact pour ce projet issu de la commande de vente. Seuls les "
24+
"contacts enfants du client peuvent être sélectionnés."
25+
26+
#. module: sale_partner_sale_contact_on_project
27+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_project_project
28+
msgid "Project"
29+
msgstr "Projet"
30+
31+
#. module: sale_partner_sale_contact_on_project
32+
#: model:ir.model.fields,field_description:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
33+
msgid "Sale Contact"
34+
msgstr "Contact Commercial"
35+
36+
#. module: sale_partner_sale_contact_on_project
37+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order_line
38+
msgid "Sales Order Line"
39+
msgstr "Ligne de vente"
40+
41+
#~ msgid "Sales Order"
42+
#~ msgstr "Bon de commande"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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,help:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
18+
msgid ""
19+
"Contact person for this project from the sale order. Only child contacts of "
20+
"the customer can be selected."
21+
msgstr ""
22+
23+
#. module: sale_partner_sale_contact_on_project
24+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_project_project
25+
msgid "Project"
26+
msgstr ""
27+
28+
#. module: sale_partner_sale_contact_on_project
29+
#: model:ir.model.fields,field_description:sale_partner_sale_contact_on_project.field_project_project__sale_contact_partner_id
30+
msgid "Sale Contact"
31+
msgstr ""
32+
33+
#. module: sale_partner_sale_contact_on_project
34+
#: model:ir.model,name:sale_partner_sale_contact_on_project.model_sale_order_line
35+
msgid "Sales Order Line"
36+
msgstr ""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2026 OpenStudio SAS
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from . import sale_order_line
5+
from . import project_project
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2026 OpenStudio SAS
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from odoo import models
5+
6+
7+
class ProjectProject(models.Model):
8+
_inherit = ["project.project", "sale.contact.mixin"]
9+
_name = "project.project"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2026 OpenStudio SAS
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
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) <simon@ogesta.fr>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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),
4+
the contact person is automatically propagated to the project. This ensures the
5+
same named commercial contact (procurement manager, project lead, etc.) visible
6+
on the sale order and its invoices is also recorded on the resulting project,
7+
without affecting project or task addresses.
8+
9+
This allows you to:
10+
11+
* Track the contact person for each project
12+
* Maintain consistency between sale orders and related projects
13+
* Display the sale contact on project forms

0 commit comments

Comments
 (0)