Applying Cost Center and Cost Units in Dolibarr. (In German Kostenstellen und Kostenträger) It seems to me that using the project module as most suitable. See:
It allow to link invoices/costs to defined projects.
However I think there should be an option to refine better involxcie positions with project tasks to get a better overview on costs per task.