FIX: propagate fk_warehouse from BOM/MO to production lines in createProduction() and processBOM() (#38147)
* FIX: propagate fk_warehouse from BOM line in processBOM() When creating MO lines from a BOM, the fk_warehouse defined on each BOM line was not copied to the corresponding MO line. This caused produceandconsumeall() to fail with a stock movement error when a warehouse is set on BOM lines but not on the MO itself. * FIX: propagate fk_warehouse from BOM line in processBOM() When creating MO lines from a BOM, the fk_warehouse defined on each BOM line was not copied to the corresponding MO line. This caused produceandconsumeall() to fail with a stock movement error when a warehouse is set on BOM lines but not on the MO itself. * Update mo.class.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
e3c93d2b1d
commit
b2b4fc0ca9
1 changed files with 3 additions and 1 deletions
|
|
@ -742,9 +742,10 @@ class Mo extends CommonObject
|
|||
$moline = new MoLine($this->db);
|
||||
|
||||
// Line to produce
|
||||
$moline->fk_mo = $this->id;
|
||||
$moline->fk_mo = (int) $this->id;
|
||||
$moline->qty = (float) $this->qty;
|
||||
$moline->fk_product = (int) $this->fk_product;
|
||||
$moline->fk_warehouse = (int) $this->fk_warehouse;
|
||||
$moline->position = 1;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
|
@ -834,6 +835,7 @@ class Mo extends CommonObject
|
|||
$this->errors[] = $this->error;
|
||||
} else {
|
||||
$moline->fk_product = $line->fk_product;
|
||||
$moline->fk_warehouse = !empty($line->fk_warehouse) ? $line->fk_warehouse : (!empty($bom->fk_warehouse) ? $bom->fk_warehouse : $this->fk_warehouse);
|
||||
$moline->role = $role;
|
||||
$moline->position = $line->position;
|
||||
$moline->qty_frozen = $line->qty_frozen;
|
||||
|
|
|
|||
Loading…
Reference in a new issue