Refuse sale order if stock is lower than the quantity required by the sale

Asked by Jonathan Liuti

Is there a native way to do a check on the stock value when validating an order and show an alert to the user telling him that the order cannot be completed because of the stock being low (no way to refill the stock).

Is it any existing module that provides this functionnality ?

thanks,
John.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Jonathan Liuti
Solved:
Last query:
Last reply:
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) said :
#1

In v6 there is natively a warning popup telling you there isn't enough
stock. I already implemented that kind of code for a customer in v5, so by
looking at how the product_id_change method is implemented in sale (or
stock) module in v6, you could provide that feature on a v5 installation.

I also suggest you check at a new module for v6 we will release soon, it
will be called "sale_exceptions". Overriding it a bit to deal with the 'out
of stock' exception that will be a true way to block your order workflow
until you have some product in stock. We should put that module in the trunk
extra addons within a week or so, but it will require extension for your
specific usage as I said.

On Tue, Feb 1, 2011 at 3:34 PM, Jonathan Liuti <
<email address hidden>> wrote:

> New question #143690 on OpenERP Server:
> https://answers.launchpad.net/openobject-server/+question/143690
>
> Is there a native way to do a check on the stock value when validating an
> order and show an alert to the user telling him that the order cannot be
> completed because of the stock being low (no way to refill the stock).
>
> Is it any existing module that provides this functionnality ?
>
> thanks,
> John.
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Server.
>

Revision history for this message
David Mitchell (www.novapointgroup.com) (david-novapointgroup.com) said :
#2

In OpenERP 6 a pop-up appears when you confirm a sales order and there
isn't enough stock. It warns the user prior to accepting the
confirmation.

However, if your use case scenario is - don't allow any orders to be
accepted because the product is discontinued (aka no way to refill the
stock), then that isn't there - based on my knowledge.

Things to consider:
Possibly suggest alternative products - that substitute - if available.
Block an order for a specific product being placed if "discontinued".

All depends on your specific user case I suppose. . . .

On Tue, Feb 1, 2011 at 12:34 PM, Jonathan Liuti
<email address hidden> wrote:
> New question #143690 on OpenERP Server:
> https://answers.launchpad.net/openobject-server/+question/143690
>
> Is there a native way to do a check on the stock value when validating an order and show an alert to the user telling him that the order cannot be completed because of the stock being low (no way to refill the stock).
>
> Is it any existing module that provides this functionnality ?
>
> thanks,
> John.
>
> --
> You received this question notification because you are a member of
> OpenERP Framework Experts, which is an answer contact for OpenERP
> Server.
>

Revision history for this message
Jonathan Liuti (liuti-john) said :
#3

Thanks David & Raphaël.

I guess our use case is not covered then as we absolutely need to block orders that are out of stock.

By the way I didn't get the warning message on my v6 install. It does trigger on virtual stock item right ? (make sense to me)

Well anyway, I'll redo some test and I will look into a custom made solution.

@Raphaël, I'm interrested in your module, i'll keep watching the trunk waiting for it. Do you have any more specifications written somewhere on what it does exactly ?

Thanks again guyz.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) said :
#4

On Tue, Feb 1, 2011 at 7:12 PM, Jonathan Liuti <
<email address hidden>> wrote:

> Question #143690 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/143690
>
> Status: Answered => Open
>
> Jonathan Liuti is still having a problem:
> Thanks David & Raphaël.
>
> I guess our use case is not covered then as we absolutely need to block
> orders that are out of stock.
>
> By the way I didn't get the warning message on my v6 install. It does
> trigger on virtual stock item right ? (make sense to me)
>

Yes, you get a popup when adding the product to the order if the virtual
stock is too low.

>
> Well anyway, I'll redo some test and I will look into a custom made
> solution.
>
> @Raphaël, I'm interrested in your module, i'll keep watching the trunk
> waiting for it. Do you have any more specifications written somewhere on
> what it does exactly ?
>

Actually, we extend the order workflow to make it able to "pre-validate"
orders. You can attach n custom exceptions to n order. One use case we have
is "not enough virtual stock" (we also have others like "we don't deliver
here, missing zip etc). We are actually importing from an external sale
system using TerminatOOOR and base_sale_multi_channels.
The stock level detection is done in OOOR in the TerminatOOOR transfo here,
but I assume you could easily do it in a python extension module. Until
exceptions are removed from an order, the workflow is stuck on purpose.

I'll let you know when we push the module.

>
> Thanks again guyz.
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Server.
>

Revision history for this message
David Mitchell (www.novapointgroup.com) (david-novapointgroup.com) said :
#5

Attached is a screen shot of the Not Enough Stock! message as an FYI to be
complete about the warning message.
Hope this helps to further clarify.

Dave

On Tue, Feb 1, 2011 at 4:12 PM, Jonathan Liuti <
<email address hidden>> wrote:

> Question #143690 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/143690
>
> Status: Answered => Open
>
> Jonathan Liuti is still having a problem:
> Thanks David & Raphaël.
>
> I guess our use case is not covered then as we absolutely need to block
> orders that are out of stock.
>
> By the way I didn't get the warning message on my v6 install. It does
> trigger on virtual stock item right ? (make sense to me)
>
> Well anyway, I'll redo some test and I will look into a custom made
> solution.
>
> @Raphaël, I'm interrested in your module, i'll keep watching the trunk
> waiting for it. Do you have any more specifications written somewhere on
> what it does exactly ?
>
> Thanks again guyz.
>
> --
> You received this question notification because you are a member of
> OpenERP Framework Experts, which is an answer contact for OpenERP
> Server.
>

Revision history for this message
Jonathan Liuti (liuti-john) said :
#6

@Raphaël: Thanx for the details, i will look into the sales workflow and see how I can extend it for my needs.

@David: attachement is missing ? ;-)

Revision history for this message
Jonathan Liuti (liuti-john) said :
#7

After diging a lot in looooads of different way of doing this, i've finally reached something acceptable.

You can check my extra-addons branch, module name is sale_order_stock_control.
Its still missing the workflow declarations (I added them manually through the gtk-client) but I plan to add it later.

If someone is interrested and wants some infos don't hesitate to ask.

Still looking forward to see your module in action Raphaël ;-)