Merge pull request #13671 from leninrivas/develop

Fix calculator to consume with to produce
This commit is contained in:
Laurent Destailleur 2020-04-22 12:56:29 +02:00 committed by GitHub
commit e93db1f3c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -590,7 +591,7 @@ class Mo extends CommonObject
}
/**
* Erase and update the line to produce.
* Erase and update the line to consume and to produce.
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
@ -648,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 = round($line->qty * $this->qty / $line->efficiency, 2);
$moline->qty = price2num(($line->qty / $bom->qty) * $this->qty / $line->efficiency, 'MS'); // Calculate with Qty to produce and more presition
}
if ($moline->qty <= 0) {
$error++;