Odoo Help


How can I show a "Not enough product at hand" warning when trying to sell products with a forecasted inventory (incoming products)?

Fermin Arellano
on 1/6/15, 1:16 AM 1,329 views

This is the scenario:

I have a product "hammer", which I have the following inventory (At hand: 7 units, Forecasted: 7 units). 

So a client comes in asking for 5 hammers, the salesman makes the sales order and the client goes to the cashier and gets his invoice. He thens gets delivered his 5 hammers and leaves. 

That transaction would leave my inventory as follows (At hand: 2 units, Forecasted: 2 Units).

Now Im gonna make a purchase order for 5 hammers. I confirm my purchase order and my supplier is going to send the products on 15 days.

That transaction would leave my inventory as follows (At hand: 2 units, Forecasted: 7 Units).

Then a new client walks in on a date previous to the arrival of my new batch of hammers and he tries to buy 5 hammers. When the salesman add the 5 hammers in the Sales Orders no warning shows up telling him he is trying to sell 5 hammers when he only has 2 at hand. But if I try to sell more than 7 hammers, which is my forecasted inventory, a warning does show up. 

Is this a bug, or is it easily configurable so that the "not enough product at hand" warning shows up when trying to sell more products than the ones at hand and not the forecasted one. 

I forgot to mention that we are a brick and mortar store, we dont sell anything online.

Fermin Arellano
on 1/15/15, 2:44 PM

Baiju KS

--Baiju KS--
| 5 5 8
Kochi, India
--Baiju KS--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju KS
On 1/6/15, 3:10 AM

Hi Arellano, We can block the sale (if quantity is not available) by following process:-
we can do some customizations in sale module to achive that change, For that you need to inherit the product_id_change_with_wh function and override to meet our new requirement.

In our function we have to give checking for quantity and block sale if quantity if not available. I have done this for one of my client. For any queries contact : baijuks@hotmail.com





| 5 3 6
Jakarta, Indonesia
On 1/6/15, 3:00 AM

In v7 the warning is controlled by the code in addons/sale_stock/sale_stock.py (line 622-629 or thereabout).  It does compare the sold quantity with virtual_available attribute of the product which takes Forecasted quantity into account.  If you want to change the warning, you need to inherit this method and change the logic.

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

1 follower(s)


Asked: 1/6/15, 1:16 AM
Seen: 1329 times
Last updated: 3/16/15, 8:10 AM