Odoo Help


[v8+ STOCK] quantity went wrong after a force availability (FIXED)

Thomas Fossoul
on 12/26/14, 3:43 AM 2,122 views


My customer has used "force availability" function to process some delivery order. Then he come back to me and told me the quantity on stock were now wrong.
I made some research on the odoo code and discover this : 

According to the comment of the def _quant_create in stock.py line 506:
'''Create a quant in the destination location and create a negative quant in the source location if it's an internal location.
Then on the def you can notice the code:
        if move.location_id.usage == 'internal':
            #if we were trying to move something from an internal location and reach here (quant creation),
            #it means that a negative quant has to be created as well.
            negative_quant_id = self.create(cr, SUPERUSER_ID, negative_vals, context=context)

So : 

For a stock move from "stock" to "partenr" (a delivery order):
If we "force assignation" when the available quantity are set to 0,
By processing the delivery order the system will not create the negative stock in the source location.
This mean the available quantity will stay to 0 instead of beeing -1. 

Is it a correct behavior ? 

PS: this seems to be working if the product is set as "consommable" and not "stockable"... so what about the stockable ?


PS2 : Actually i didn't read correctly : if move.location_id.usage == 'internal':

The code is corrrectly writed. :)



Thanks in advance

On 12/26/14, 4:40 AM


Actually the odoo build in functionality is to do like that...

when u click "Check availability" if product available then it makes "deliver" button to view...

if not force availability is the only option...

but force availability takes the quantity from "quantity on hand". so on emergency purpose only we should use "force availability"... or else use "check availability"

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: 12/26/14, 3:43 AM
Seen: 2122 times
Last updated: 3/16/15, 8:10 AM