2015-05-14 14:48 GMT+02:00 Cédric Krier <[email protected]>: > On 14 May 14:25, Albert Cervera i Areny wrote: >> 2015-05-14 9:56 GMT+02:00 Christophe (net) <[email protected]>: >> > Le 14/05/2015 09:00, Cédric Krier a écrit : >> >> >> >> On 14 May 08:29, Christophe (net) wrote: >> >>> >> >>> Le 13/05/2015 17:46, Cédric Krier a écrit : >> >>>> >> >>>> Hi, >> >>>> >> >>>> I started a review for a new module sale_stock_quantity [1] >> >>>> See the description for a complete explaination of the behaviour. >> >>>> >> >>>> I have just one concern about a possible option to skip the check for >> >>>> some products. >> >> >> >> >> >>> I think it's better to have an explicit option to avoid checking. Use >> >>> different information (like suply delay) may not respond to the greatest >> >>> possible number of cases. >> >> >> >> >> >> And where will you put this option? >> >> >> > >> > for me on the object product.product >> > >> >> +1 >> >> Sounds very reasonable to desire the warning with those products you >> purchase (or produce) in advance (typically creating an order point) >> but not with those that are purchased on demand. > > But in this case, you will have a supply delay computed from the product > suppliers and the module will warn you if you sale it before you can > have it. > http://codereview.tryton.org/7141002/diff/1/sale.py#newcode153 >
I had not looked at the code and misunderstood the requirement. Looks nice. A great improvement would be to consider production delays too, but that carries a good amount of complexity in itself. Yet, maybe we could consider refactoring check_stock_quantity() to allow that improvement to be implemented by another module, which could take advantage of the stock calculated. Another possible improvement I see is to just get the stock of those products marked as purchaseable. If I understand the code correctly those that are not purchaseable will get a supply date by get_supply_dates() which will never cause a warning. So no need to calculate their stock in the first place. -- Albert Cervera i Areny Tel. 93 553 18 03 @albertnan www.NaN-tic.com
