Fix assignment with moLine to BomLine

This commit is contained in:
Lamrani Abdel 2024-03-15 15:47:48 +01:00
parent 3c7f5391e5
commit b4ffcf400f
2 changed files with 15 additions and 2 deletions

View file

@ -231,7 +231,7 @@ class Mo extends CommonObject
protected $childtablesoncascade = array('mrp_production');
/**
* @var MoLine[]|BOMLine[] Array of subtable lines
* @var MoLine[] Array of subtable lines
*/
public $lines = array();

View file

@ -432,7 +432,20 @@ if ($action == 'create') {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
$object->lines = $objectbom->lines;
$arrayOfObjBom = array();
foreach ($objectbom->lines as $key => $val) {
$moLine = new MoLine($db);
$moLine->id = $objectbom->lines[$key]->id;
$moLine->position = $objectbom->lines[$key]->position;
$moLine->fk_product = $objectbom->lines[$key]->fk_product;
$moLine->fk_unit = $objectbom->lines[$key]->fk_unit;
$moLine->qty = $objectbom->lines[$key]->qty;
$moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen;
$moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change;
$arrayOfObjBom[] = $moLine;
}
$object->lines = $arrayOfObjBom;
$object->mrptype = $objectbom->bomtype;
$object->bom = $objectbom;