Przeglądaj źródła

Merge pull request #22303 from atm-lena/develop_FIX_BOMServices_CostCalculWorkstation

Bom services : fix calcul of cost for line without workstation
Laurent Destailleur 2 lat temu
rodzic
commit
d19bb01f03
2 zmienionych plików z 8 dodań i 10 usunięć
  1. 7 9
      htdocs/bom/class/bom.class.php
  2. 1 1
      htdocs/langs/fr_FR/mrp.lang

+ 7 - 9
htdocs/bom/class/bom.class.php

@@ -1369,16 +1369,14 @@ class BOM extends CommonObject
 					$unit = measuringUnitString($line->fk_unit, '', '', 1);
 					$qty = convertDurationtoHour($line->qty, $unit);
 
-					if ($conf->workstation->enabled) {
-						if ($tmpproduct->fk_default_workstation) {
-							$workstation = new Workstation($this->db);
-							$res = $workstation->fetch($tmpproduct->fk_default_workstation);
-
-							if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
-							else {
-								$this->error = $workstation->error;
+					if ($conf->workstation->enabled && !empty($tmpproduct->fk_default_workstation)) {
+						$workstation = new Workstation($this->db);
+						$res = $workstation->fetch($tmpproduct->fk_default_workstation);
+
+						if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
+						else {
+							$this->error = $workstation->error;
 								return -3;
-							}
 						}
 					} else {
 						$line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT');

+ 1 - 1
htdocs/langs/fr_FR/mrp.lang

@@ -82,7 +82,7 @@ ProductsToProduce=Produits à produire
 UnitCost=Coût unitaire
 TotalCost=Coût total
 BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le prix de revient si défini, sinon le PMP si défini, sinon le meilleur prix d'achat)
-BOMTotalCostService=Si le module "Poste de travail" est activé, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service"
+BOMTotalCostService=Si le module "Poste de travail" est activé et qu'un poste de travil est défini par défaut sur la ligne, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service"
 BOMProductsList=Liste des composants
 BOMServicesList=Liste des services
 GoOnTabProductionToProduceFirst=Vous devez avoir la production pour clôturer un Ordre de Fabrication (voir onglet '%s'). Mais vous pouvez l'annuler.