Fix: A lot of fix in stock value calculation.

This commit is contained in:
Laurent Destailleur 2010-07-14 15:41:41 +00:00
parent f55d82dee5
commit 9dfb79ebc8
4 changed files with 7 additions and 6 deletions

View File

@ -66,7 +66,7 @@ if ( $_GET['filtre'] ) {
$sql = "SELECT p.rowid, ref, label, tva_tx"; $sql = "SELECT p.rowid, ref, label, tva_tx";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.envente = 1"; $sql.= " WHERE p.envente = 1";
$sql.= " AND p.fk_product_type = 0"; $sql.= " AND p.fk_product_type = 0";
$sql.= " ORDER BY p.label"; $sql.= " ORDER BY p.label";

View File

@ -408,7 +408,7 @@ class Expedition extends CommonObject
$i=0; $i=0;
while($i < $num) while($i < $num)
{ {
dol_syslog("Expedition::valid movment index ".$i); dol_syslog("Expedition::valid movement index ".$i);
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0) if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)

View File

@ -547,7 +547,7 @@ if ($_GET["action"] == 'create')
if ($_REQUEST["entrepot_id"]) if ($_REQUEST["entrepot_id"])
{ {
//var_dump($product); //var_dump($product);
$stock = $product->stock_entrepot[$_REQUEST["entrepot_id"]]; $stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real;
$stock+=0; // Convertit en numerique $stock+=0; // Convertit en numerique
$defaultqty=min($quantityToBeDelivered, $stock); $defaultqty=min($quantityToBeDelivered, $stock);
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;

View File

@ -9,6 +9,7 @@
-- Add unique key -- Add unique key
ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot); ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot);
ALTER TABLE llx_product_stock drop column location;
-- Add missing table llx_product_association -- Add missing table llx_product_association
create table llx_product_association create table llx_product_association