Fix creation of MRP when product is a kit.

This commit is contained in:
Laurent Destailleur 2020-11-26 14:32:40 +01:00
parent 187ba94a57
commit f231620084
2 changed files with 4 additions and 2 deletions

View File

@ -77,3 +77,4 @@ UnitCost=Unit cost
TotalCost=Total cost
BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price)
GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it.
ErrorAVirtualProductCantBeUsedIntoABomOrMo=A kit can't be used into a BOM or a MO

View File

@ -250,10 +250,11 @@ class Mo extends CommonObject
$this->db->begin();
if ($this->fk_product > 0) {
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$tmpproduct = new Product($this->db);
$tmpproduct->feth($this->fk_product);
$tmpproduct->fetch($this->fk_product);
if ($tmpproduct->hasFatherOrChild(1) > 0) {
$this->error = 'AVirtualProductCanBeUsedIntoAMO';
$this->error = 'ErrorAVirtualProductCantBeUsedIntoABomOrMo';
$this->errors[] = $this->error;
$this->db->rollback();
return -1;