Contributors mailing list archives

Browse archives


Re: New module to create project and tasks with associated hours from Sale Order

Le Filament, Rémi Cazenave
- 17/12/2018 11:01:23

Dear Rafael, Jose, all,

Today you can indeed configure for each service product in track_service field :

  • a project (by selecting timesheet) : when validating sale order, this would then automatically create a project with Sale Order reference (which is not really convenient to understand what the project is about, you may then want to manually rename the corresponding project). It would then track the hours on that project and report them in sale order, when you report more hours than the number sold, it would tag the sale order as upselling opportunity (meaning you can maybe sell more than what was foreseen in sale order since you spent more time than estimated).
  • a task (by selecting task) for which only spent time will be invoiced to customer by default (whatever the quantity you had in your sale order originally). You can either select a project where all tasks will be assigned by default or leave blank to create a new project with sale order ref as name and task inside (as for previous solution)

The way we work with our customers, we saw 2 drawbacks to both above possibilities:

  • you need to define your unit of measure in hours in your sale order in order to be able to use the timesheet functionality --> Most of the time we do not sell hours, but either days or fixed amount for a service and therefore you cannot use the above functionalities because you will have X as quantity which are not hours (either days or number of services sold), when it expects hours.
  • you cannot define the project name, and need to update it afterwards to make it understandable.

The above did not fit most of our use cases since we usually invoice the amount from sale order, independantly of spent hours on each line (that we track at project level though).

We then created this module in order to :

  • Create a wizard that let you type in the project name you want to use (or reuse an existing one)
  • Create a new track_service named project (in order to keep the 2 above default functionalities, not to break the other use cases) which then allows you to select :
    • a project where the task will be added (or leave blank for project created / assigned to sale order) - same functionality as above when selecting task
    • define a default stage to which the task will be assigned (if not set it will either not assign a stage or use default stage that can be set in overall project settings)
  • For all sale order lines using a service tracked as project it will create a task with
    • name =
      • "CUSTOMER - Stage name" when a default project and default stage are defined
      • "CUSTOMER" when a default project but no default stage are defined
      • first line of sale order line description when no default project is defined
    • description = sale order line description
    • assigned hours = sale order line subtotal / daily price * worked hours per day (the 2 last variables are taken from overall project settings)
  • In case you would update sale order after validation (for instance by adding quantities to a line or adding a new line), a button also allows you to update tasks accordingly

At our level, we even follow hours / budget at project level (on top of task level), so we assign / update hours also at that level, but we considered that this was maybe too specific so I removed it from the proposed module.

Maybe it can be better explained with an example : when we sell a new Odoo instance and functionalities to a customer we usually have in a sale order :
  1. Lines for each major functionality, including installation / specific configuration / hands-on to customer - the unit and default price of these services is usually days and we sell for instance 0.5 to 3 days per line
  2. 1 line for 1-year maintenance which is a fixed price (and thus with quantity = 1)
  3. 1 line for support which is an amount of hours (and we sell for instance 5 hours of support in sale order)
The service products for the above are configured as follow:
  1. track_service = project with no default project assigned and no default stage
  2. track_service = project with default project = MAINTENANCE and default stage = Odoo (we also maintain other systems)
  3. track_service = project with default proejct = Support (for this one we could also use task as track_service but we would then have to rename the corrresponding task since default naming is not appropriate from our point of view)

We then configure in overall project settings :

  • the default stage = TODO
  • default daily price
  • default number of worked hours per day
When clicking on create project button on a validated sale order, we end up with :
  1. 1 task per order line inside project name selected at wizard level (we use CUSTOMER - Project Name as default rule) each with correct assigned hours with respect to the line subtotal and default stage = TODO
  2. 1 task in MAINTENANCE project in Odoo stage named CUSTOMER - Odoo (and we even added a calculation of deadline as x * 1 year after the current date in original module, but that we also considered too specific), also with a correct number of hours assigned
  3. 1 task in Support project in TODO stage named CUSTOMER

Best Regards,

On 15/12/2018 10:06, José L. Sandoval A. wrote:
How can you do that?

From: Rafael Blasco <>
Sent: Saturday, December 15, 2018 5:16:59 AM
To: Contributors
Subject: RE: New module to create project and tasks with associated hours from Sale Order



I still miss what specific do you need. This is already in Odoo v10 an v11


-          You can already create Project and task with associated hours from the sale order

-          You can choose also in Odoo CE to create a new project or to create task in an existing project


What is missing?


I recorded a video:










De: Rémi CAZENAVE - Le Filament []
Enviado el: viernes, 14 de diciembre de 2018 10:47
Para: Contributors <>
Asunto: Re: New module to create project and tasks with associated hours from Sale Order


Dear Thorsten,

thank you for your feedback, I fixed the error which was a mistake from my side, something I forgot to remove (since we also used to have hours and price calculated at project level, but did not seem relevant for proposing this module to OCA).

The Update tasks button allows you :

  • create new tasks in case you add a new line to your sale order (for instance in case you proposed some options that your customer now wants integrated)
  • update task amount and planned hours in case you have updated delivered quantities on one of your sale order line


Instead of continuing discussion on this mailing list, I will create corresponding PR on project repo.


Best Regards,



On 07/12/2018 10:46, Thorsten Vocks wrote:



i have tested the module and to my opinion it provides an added-value compared to Odoo standard.


If a user decides to create a task, he can decide in which project to create the task, either a new one or a existing one.

For sure creation of a task from a sale order line works already in Odoo, however you either have to create in any case 

a new project without being able to influence the project's name, or you have to assign a fixed project to your service product in 

order to create your sale order related task(s) in a fixed project. In worst case a sale user would have to communicate with the project manager in order to assign a proper project name and a stage before starting to work on the project's tasks or probably even 

more worse the sale user would have to leave the drafted sale order to complete the project related settings before 

being ready to proceed further with the drafted sale order.


To my opinion the wizard to link project / task to a sale order makes sense, as it is more flexible and obviously doesn't 

break or replace the Odoo standard way.


I am not sure If it makes sense to calculate the associated scheduled task time by dividing sale price through fixed daily costs 

configured in project configuration, however it is better as the value „00:00 hrs“ on a new task created by Odoo standard functionality.

Currently I do not get the idea of the „Update tasks“ button, it is described as: „ 4. On sale order line update, click on button Update tasks to update projects and tasks associated with this sale order.“


In my case there is an error if i click on it:

 File "/odoo/odoo-server/odoo/", line 672, in call_kw_multi

    result = method(recs, *args, **kwargs)

  File "/odoo/odoo-server/addons/link_sale_project_tasks/models/", line 40, in saleorder_update_tasks

    (line.price_subtotal / lf_tarif_jour)

TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'



If i understand correctly you create the new task(s) at the time you confirm a sale order. Is it intended to assign further tasks after the sale order is confirmed already ? Maybe it will be more clear if the error wouldn't  popup anymore.


Finally I would propose to the project steering guys to include that module in the OCA/project repository, if the error could 

be fixed or if it could be explained how to avoid that error.


Best regards


Thorsten Vocks
Dipl. Kaufmann (FH)
Porscheweg 4-6
49661 Cloppenburg

Phone: +49 4471 8409000
Fax: +49 4471 84090009





Am Mi., 5. Dez. 2018 um 19:02 Uhr schrieb Rémi CAZENAVE - Le Filament <>:

Dear all,

we have been working lately on a module that creates projects and tasks based on sale order lines for Odoo v10.

Basically, you configure a number of products that would be transformed in tasks (with content of sale order line), and it calculates the amount of hours to assign to the project and each task based on the quoted amount.


I guess this could be interesting for the community, so we were thinking about where to push it in OCA repos ?

I know there is already a sale_order_project module in project repo which covers only the creation of project from sale order (but not tasks and not allocating time).

I guess that both could live in parallel since ours depends on sale_timesheet which may not be needed in some use case where you would only need to create project from sale order without caring about tasks and allocated time.


You can find the module here for now :


What do you think ?

Thank you,

Best Regards,



Post to:

Post to: