Odoo Help


How to get the cost of products on analytic account?

Endian Solutions B.V.
on 3/27/14, 10:22 AM 2,339 views

I have created an analytic account for an installation project. The analytic account of the sale order with all products and fixed hours are reflected on invoice and become income on the analytic account. This is perfect.

For the spend hours the employees enter their time sheet and this is added as cost on the analytic account. Also perfect.

But...The products come from stock. So we can't connect the analytic account to the purchase of the products.

So how to get the cost of the products to the analytic account? Is there a way to make 2 analytic entries on sale invoice? 1 for the income=qtysale price and 1 for cost=qtycost price?

Anyone an idea?

Endian Solutions B.V.
on 3/31/14, 8:50 AM
matt crouch
On 4/16/15, 1:52 PM

There is no way in stock Odoo to do this, at least not that I could find. However,  we can create a solution.

My solution was to add on to my existing (custom) accounting module. It was quite some hassle to figure out the best way to do this, but I managed a solution, although I am not sure if it is elegant.


Journal Entries are created in the accounting account (distinct from an analytic account) by the system for outgoing stock moves for delivery orders (in the default setup, anyway). Each of these journal entries can optionally have an associated analytic _distribution_. In turn, this distribution can be associated with a specific analytic account (Ugh).

I have modified the python method used to create these such that the accounting entry will inherit the analytic account from the sale order (if one is specified). In addition, I have a procedure for automatically creating analytic Distributions linked to the appropriate analytic accounts at the level of a job (in my instance, we use Opportunities). If you do not have the ability to create a custom module, you can also perform the same functionality by creating an automated action triggered on creation.

Note that it is also possible to set an analytic account by default for each product sold - so, for example, a purchase of an 'Airfare' product would automatically be appended to an 'Airfare' analytic account. This might conflict with any automated rule, so a custom module is the best option.

I consider the lack of this feature in stock Odoo to be a pretty big gaping hole. I imagine most people don't use the analytics, then, or most companies that use them are service companies. O I missing something big (very very possible, but I couldnt figure out a better way in the existing codebase after some searching... :( )

Sorry, looks like I cant post screenshots, but I'll make a post to the OCA, and anyone interested in this in more detail can contact me privately.

Igor MF
On 6/23/14, 12:08 PM

Same question here! Anyone?


Anyone, please?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 3/27/14, 10:22 AM
Seen: 2339 times
Last updated: 12/30/17, 9:10 AM