Community mailing list archives


Re: Back-dated Inventory Adjustments

Brightwave LTD, Jesse Morgan
- 05/20/2017 19:14:57
This issue can turn out to be more complicated than expected if using average product costing.
All the stock backdating modules I looked at simply force the stock move and quant dates to be in the past.

However they do not address the issue of negative reconciliation of quants. Quants can end up being reconciled in the wrong order, leading to incorrect average costs being calculated.

I had this issue.
I ended up writing an application that connects directly to the database and replays all moves from the start in order of date, updating account moves along the way, rewriting product_price_history from scratch, and rewriting quants (and move quant relation) from scratch, and recalculating product cost (average)

This is obviously highly scary and not at all recommended - but I spent two weeks testing it and confirmed it was all working 100% as expected first - and also happened to find a bug in Odoo along the way!

On 28 April 2017 at 05:00, Visti Kristensen <> wrote:



We have also had this problem when we started our own O10E.

The trick on server dates is useable, but not the thing to do on the long run.

Our customers ask for this as they always count for some days and put it in the system later.

In many other systems this is basic feature.


As we are implementing systems all the time for new customers with same request we are developing a new module for forcing the inventory date in the same way as Odoo is forcing the accounting date (in V10E)


If you are interested, please let me know.
We will have focus on the module for V10E as we mainly work on Enterprise solutions, but let’s see if it also will work on V10C as well.


Visti Kristensen

VK Data ApS

Odoo Gold Partner in Denmark and Sri Lanka

+45 40452191



Fra: Jesse Morgan []
Sendt: 27. april 2017 17:12
Til: Community <>
Emne: Re: Back-dated Inventory Adjustments


Hi Timothy, Cybrosis, 


Thanks for the info. Yep what you two are saying matches up with my thoughts. 


Will have a go implementing such a module for v9. It actually seems quite straight forward. 







On Apr 28, 2017 12:56 AM, "Timothy Stonis" <> wrote:

Hi All,

  I also had this problem - especially when moving from one ERP system to the next and you need to run in parallel for some time where the legacy system is the "lead" system. I don't know if this is the right method either, but seemed to work in my limited testing of v9 using "real" inventory valuation:

  1) Make the the existing "date" field of stock.picking visible in stock.view_picking_form so you can set the date
  2) Extend stock.quant's _quant_create() to a) set record_date to picking date (if there is a picking), b) set the "force_period_date" context variable to record_date, and c) write the quant with "in_date" of record_date
  3) Extend move_quant_write() like (a) and (b) above
  4) Extend stock.move's write() method to take the picking_id's date

  Feel free to email me if you'd like my code. 



Timothy Stonis

April 27, 2017 8:10 AM, "Cybrosys Technologies" <> wrote:

We have gone through such a situation with one of ours client. They must enter their old purchase orders and sale orders into the system.

They created some purchase order with the correct date. But stock valuation and related journal entries are using current date and time.

So we created a small module that adds an extra DateTime field into picking. and overrode some functions to consider the date mentioned in the new field while creating quant and journal entry. If there is any date in the new field, The system will take that date. Otherwise, the system will go with its usual flow.

We hope it is a right method. Let us know if it is not



On Thu, Apr 27, 2017 at 1:55 PM, aasim ansari <> wrote:


But this is not a practical solution.

For v8 there is a module called stock_move_backdating. For v9 and v10, I don't know if there is any such module available.





Aasim Ahmed Ansari

Cell: +91 9619 424 386


On Thu, Apr 27, 2017 at 12:50 PM, Jesse Morgan <> wrote:

I found a workaround (or hack) to this issue.

It's a bit outside the square - but it works:

1) Make sure everyone is logged out of the system

2) Change the date on the server back to 31/03/2017

3) Create a stock move to fill all the counted stock quants from virtual/inventory loss to stock

4) Validate

5) Change clock back to now

Does exactly what I want. Anyone see any issues?


On 27 April 2017 at 14:21, Jesse Morgan <> wrote:

Hi there,

We started using Odoo at the beginning of April.

When we started, we made the decision to start with no stock levels loaded; allowing the point of sale module to sell stock into negatives.

The reasoning for this is that the previous system before Odoo was much more manual, and needed to be manually updated with sales records before being closed off, to get the final closing stock to import into Odoo.

We now have the closing stock levels as at March 31st, and I am trying to get them loaded into Odoo.

What I was hoping was that I could do a back-dated inventory adjustment, and date it at March 31.

So if we had qty 10 of a product in stock as at March 31, but we had sold 5 in Odoo during April, - before the inventory adjustment the quantity in Odoo would be -5; but after the adjustment it would be +5

However looking at the code for stock.inventory, it does not seem that any date checks are done at all when looking at quants in the system.

I know you can override the accounting date for a stock adjustment - but you can't override the inventory date.

If I modify the inventory date in the database (as a test), it is effectively ignored; with any created stock moves still having the current date, and including 'minusing out' the CURRENT stock on hand (negative), before adding in the stock on hand as at March 31; effectively nullifying April's moves.

Does anyone else have experience with this situation?

The only thing I can think to do is manually subtract any goods sold in April from the March closing stock using Excel, then do that as an adjusment dated at current date.

Any input much appreciated.




Post to:




Cybrosys Odoo Department

 +91 494 3015006 / 07

 +91 8606827707



Facebook Twitter LinkedIn Google Plus Pinterest Company

This email and any file transmitted with it are confidential and intended solely for the use of the individual or entity whom they are addressed.If you have received this email in error please notify the system manager. The company accepts no liability for any damage caused by any virus transmitted by this email.

Post to:

Post to:

Post to:

Post to: