Fix MRP: Add hook calculateCostsBomAfter to alter BOM costs (#35465)
* fix doc (#35416) * fix doc * Update commonobject.class.php * Update mo.class.php * FIX missing entity filter (#35461) * Add post-processing hook `calculateCostsBomAfter` in BOM cost calculations --------- Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com> Co-authored-by: Regis Houssin <regis.houssin@inodbox.com> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
023e3081a4
commit
049cbbfb4d
3 changed files with 4 additions and 2 deletions
|
|
@ -1404,6 +1404,7 @@ class BOM extends CommonObject
|
|||
$reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($reshook > 0) {
|
||||
$hookmanager->executeHooks('calculateCostsBomAfter', $parameters, $this); // Note that $action and $object may have been modified by hook
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
|
@ -1501,6 +1502,7 @@ class BOM extends CommonObject
|
|||
$this->unit_cost = (float) price2num($this->total_cost * $this->qty, 'MU');
|
||||
}
|
||||
}
|
||||
$hookmanager->executeHooks('calculateCostsBomAfter', $parameters, $this);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||
$HEIGHT = '192';
|
||||
|
||||
$stats = new FactureStats($this->db, $socid, $mode, 0);
|
||||
$stats->where = "f.fk_statut > 0";
|
||||
$stats->where = "f.entity IN (".getEntity('invoice').") AND f.fk_statut > 0";
|
||||
$px1 = null;
|
||||
$px2 = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
|
|||
$HEIGHT = '192';
|
||||
|
||||
$stats = new FactureStats($this->db, $socid, $mode, 0);
|
||||
$stats->where = "f.fk_statut > 0";
|
||||
$stats->where = "f.entity IN (".getEntity('invoice').") AND f.fk_statut > 0";
|
||||
|
||||
// Build graphic amount of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
$data2 = $stats->getAmountByYear($numberyears);
|
||||
|
|
|
|||
Loading…
Reference in a new issue