Before this commit, when the project has no SO set in its model and it
has a task with a SO set. When the user clicks on the Sales Order stat
button shown in project form or the project update. He sees a form view
of `sale.order` to create a new record because the action does not give
the id of the Sales Order related. Indeed, we give the id of the SO set
on the project if we found only one SO related to the project.
This commit fixes the issue by given the id of the SO related to allow
the user to see the SO related to the project.
Steps to reproduce:
==================
1) Create a project A with allow_billable set to `True`.
2) Create a Quotation for a customer C with a SOL containing service
product and confirm it to create a SO.
3) Create a task in the project A and set the customer C to this task
and set the SOL of the SO created in the step 2.
4) Go to the project update of the project A
5) Click on the 'x Sales Orders' stat button.
Expected Behaviour:
==================
The user should see the SO related to the project, that is the one
selected in the related task.
Actual Behaviour:
================
The user sees an empty form view of `sale.order` to create a SO because
no SO is found.
Part of task-2710808
Closes#81940closesodoo/odoo#82284
X-original-commit: de702d921a321a8b783af020538ceaf4ef3af10f
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>