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 Can switch product batch management to no management. #21691

Conversation

atm-gauthier
Copy link
Contributor

No description provided.

@atm-gauthier
Copy link
Contributor Author

Hi @eldy, in this PR i did corrections you asked to @atm-adrien (old PR : #21503).
Now we check llx_product_batch table and loop on results to move batch stock into global stock.

@eldy eldy added the PR to fix or conflict to solve PR needs to be fixed to be integrated (except for conflicts, a comment describes the fix to do) label Aug 22, 2022
@atm-gauthier
Copy link
Contributor Author

Hi @eldy, you can see here what's added :

First i we stop using serial numbers or batch, this message appears :
image

Second thing if our product status batch was batch, we'll no longer be able to choose serial number, because Dolibarr doesn't know in which serial number dispatch each quantity :
image

@eldy
Copy link
Member

eldy commented Dec 28, 2022

Ok for first point.

For the second point,
"Second thing if our product status batch was batch, we'll no longer be able to choose serial number, because Dolibarr doesn't know in which serial number dispatch each quantity"
We should not block the selection of "Use serial". Showing a warning like this should be enough: "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 object with the same serial (when you want it to be unique). The duplicate will remain until an inventory or a manual stock movement to fix this is done."

Switching first to "no" choice, to "delete" existing serial seems is a bad idea as we will loose information. For example we may want to convert lot A into Lot A-1, Lot A-2, ... and lot B into Lot B into Lot B-1, Lot B-2.
Can you just show a warning whit no data deletion (cleaning of data will be done later by inventory or manual stock move) ?
So only a warning must be shown. This is not a problem for dolibarr there is a protection to disallow any stock movement if product is not unique, except if we make a movement to make the serial unique. So warning is enough.
Can you change this way ?
Also this change the behaviour, so thanks to push it on develop.

@eldy eldy changed the title New batch stock mouvements to global stock mouvement NEW Can switch product batch management to no management. Oct 8, 2023
@@ -1944,7 +1944,45 @@
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, (GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch));

print $form->selectarray('status_batch', $statutarray, $object->status_batch);
Copy link
Member

Choose a reason for hiding this comment

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

On error, we should not lose the user initial delection, so can you restore the test on GETPOSTISSET in current line of code ?

@eldy eldy added PR OK to merge (but suggested fix required) PR was analyzed by PR merger and seems ok to be merged as soon as a fix has been published and removed PR to fix or conflict to solve PR needs to be fixed to be integrated (except for conflicts, a comment describes the fix to do) labels Oct 8, 2023
@eldy eldy merged commit f46482a into Dolibarr:develop Oct 23, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR OK to merge (but suggested fix required) PR was analyzed by PR merger and seems ok to be merged as soon as a fix has been published
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants