Class 'MouvementStock' not found

Hello,

If I have the Stock module configured like this:

when I cancel an order, I get this error

Has anybody reported it?

My version is 2.8.1, and I have tested it in several diferent servers, both local or remote

I am facing the same problem :unhappy:

Try to add line
require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
before line 478 of file.

Thanks eldy for your help,

I added this require, and of course this error disappeared, but I get this one instead:

[code]
Dolibarr has detected a technical error.
This information can help to diagnose:
Dolibarr: 2.8.1
Date: 20100517104302
Level of features: 0
Server: Apache
Referer: http://www.xxxxxxxxx.com/htdocs/commande/fiche.php?id=4&action=cancel
Requested Url: /dolibarr/htdocs/commande/fiche.php?id=4&action=confirm_cancel&confirm=yes
Menu manager: eldy_backoffice.php/eldy_backoffice.php

Message: 3

Warning: Cannot modify header information - headers already sent by (output started at /homepages/21/d260888138/htdocs/rsipruebas/dolibarr/htdocs/lib/functions.lib.php:1917) in /homepages/21/d260888138/htdocs/rsipruebas/dolibarr/htdocs/main.inc.php on line 707[/code]

I hope this gives you some useful info to help me… Thanks!

Yes. I found.

In file commande.class.php replace

$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$entrepot_id = “1”; //Todo: ajouter possibilite de choisir l’entrepot
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);

if ($result > 0)

by

if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
{
$mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products)
$entrepot_id = “1”; //Todo: ajouter possibilite de choisir l’entrepot
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
if ($result < 0) { $error++; }
}

if (! $error)

Ok, thank you.

With these changes, the error dissapears, but if I cancel the order, isn’t it supposed the stock to be refund? Now, it’s not.

Let’s see an example:

  1. My stock for one product is 50 units
  2. I make an order for 10 units. Validate the order
  3. The stock now is 40 units (because of the stock module configuration)
  4. I cancel the order. The stock is suposed to be 50 units again, but it’s not: it’s still 40 units.

thanks

Great Observation Rsicom…

How can we do to report this bug? By posting it here is enough?

Decrease off stock on cancel has been added in CVS.