Skip to content

Commit

Permalink
CLOSE #27048 add form to globally set "VARIANT_ALLOW_STOCK_MOVEMENT_O…
Browse files Browse the repository at this point in the history
…N_VARIANT_PARENT" variable (#27049)

This commit adds another option to the variants module to set the global variable "VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT".
This variable allows the variant parent product to be used in stock movements.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
  • Loading branch information
DaBootO and eldy authored Feb 12, 2024
1 parent e89dd3b commit 870395b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/langs/en_US/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,8 @@ ModifyValueExtrafields = Modify value of an extrafield
OrProductsWithCategories=Or products with tags/categories
WarningTransferBatchStockMouvToGlobal = If you want to deserialize this product, all its serialized stock will be transformed into global stock
WarningConvertFromBatchToSerial=If you currently have a quantity higher or equal to 2 for the product, switching to this choice means you will still have a product with different objects of the same batch (while you want a unique serial number). The duplicate will remain until an inventory or a manual stock movement to fix this is done.

AllowStockMovementVariantParent=Allow stock movements on the variant parent

ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?<br>The quantities currently set in the inventory will be reset.

8 changes: 8 additions & 0 deletions htdocs/variants/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
$error++;
}

if (!dolibarr_set_const($db, 'VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT', GETPOST('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}

if (!$error) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
Expand Down Expand Up @@ -83,6 +88,9 @@
}
print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';

print '<tr class="oddeven"><td>'.$langs->trans('AllowStockMovementVariantParent').'</td><td>';
print $form->selectyesno("VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT", getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 1).'</td></tr>';

print '</table>';

print '<br><div class="center"><input type="submit" value="'.$langs->trans("Save").'" class="button button-save"></div>';
Expand Down

0 comments on commit 870395b

Please sign in to comment.