Merge pull request #18070 from altairisfr/fixof

FIX : division by zero on of create
This commit is contained in:
Laurent Destailleur 2021-07-02 16:00:24 +02:00 committed by GitHub
commit cc54ba1866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -649,7 +649,7 @@ class Mo extends CommonObject
if ($line->qty_frozen) {
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
} else {
$moline->qty = price2num(($line->qty / $bom->qty) * $this->qty / $line->efficiency, 'MS'); // Calculate with Qty to produce and more presition
$moline->qty = price2num(($line->qty / ( ! empty($bom->qty) ? $bom->qty : 1 ) ) * $this->qty / ( ! empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and more presition
}
if ($moline->qty <= 0) {
$error++;

View File

@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf))
if (!is_object($form)) $form = new Form($db);
$qtytoconsumeforline = $this->tpl['qty'] / $this->tpl['efficiency'];
$qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 );
/*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
}*/