Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW : allow stock management by product #26200

Closed

Conversation

thomas-Ngr
Copy link
Contributor

@thomas-Ngr thomas-Ngr commented Oct 12, 2023

NEW : allow stock management by product

When using product stocks, users may want to have some products for which they don't want to manage stocks, for example in case of subcontracting.

This PR:

  • adds a field "Stockable product" on product card (editable on update, not on create)
  • sets this option to 1 by default
  • hides the "stocks" tabs if this option is not set
  • does not manage stock movements for a product if this option is not set.

Discussion started on #26184

SQL Part : #26190

@thomas-Ngr thomas-Ngr marked this pull request as ready for review November 15, 2023 15:17
@@ -2300,6 +2339,7 @@
$product_static->surface_units = $lines[$i]->surface_units;
$product_static->volume = $lines[$i]->volume;
$product_static->volume_units = $lines[$i]->volume_units;
$product_static->stockable_product = $lines[$i]->stockable_product;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thomas-Ngr
I believe this line does not work as $lines[$i]->stockable_product does not exist.

if ($lines[$i]->product_type == Product::TYPE_SERVICE && !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) {
print '<span class="opacitymedium">('.$langs->trans("Service").')</span>';
} elseif ($lines[$i]->entrepot_id > 0) {
} elseif ($lines[$i]->entrepot_id > 0 && $lines[$i]->product->stockable_product == Product::ENABLED_STOCK) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thomas-Ngr
Same here; this $lines[$i]->product->stockable_product does not exist in the object $lines[$i]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants