Optimized/clarified new "Hide product from stock overview" option (references #906)

This commit is contained in:
Bernd Bestel 2020-12-21 20:43:10 +01:00
parent 694b78f72a
commit c1ac9e8a45
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
6 changed files with 27 additions and 20 deletions

View File

@ -55,7 +55,8 @@
- On the purchase page the amount field is now displayed above/before the due date for better `TAB` handling (thanks @kriddles)
- Changed that when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is disabled, products now get internally a due date of "never overdue" (aka `2999-12-31`) instead of today (thanks @kriddles)
- Products can now be disabled to keep the history/journal, but hide it everywhere, without deleting it (new product option "Active", deleting a product now explicitly also deletes its journal and all other references) (thanks @kriddles for the initial work on this)
- Products can now be hidden from the stock overview page (new product option "Show on stock overview page", enabled by default, so no changed behavior when not configured)
- Products can now be hidden from the stock overview page, even if they are in-stock (new product option "Never show on stock overview", disabled by default, so no changed behavior when not configured)
- That's maybe useful for parent products you only use as a kind of "container"
- The due date is now also prefilled on the inventory page based on the products "Default due days" (was only done on the purchase page before)
- On the stock journal page, it's now visible if a consume-booking was spoiled
- It's now tracked who made a stock change (currently logged in user, visible on the stock journal page) (thanks @fipwmaqzufheoxq92ebc)

View File

@ -1997,7 +1997,7 @@ msgstr ""
msgid "Show disabled"
msgstr ""
msgid "Show on stock overview page"
msgid "Never show on stock overview"
msgstr ""
msgid "None"
@ -2068,3 +2068,6 @@ msgstr ""
msgid "Link"
msgstr ""
msgid "The stock overview page lists all products which are currently in-stock or below their min. stock amount - enable this to hide this product there always"
msgstr ""

View File

@ -70,7 +70,7 @@ CREATE TABLE products (
cumulate_min_stock_amount_of_sub_products TINYINT DEFAULT 0,
due_type TINYINT NOT NULL DEFAULT 1 CHECK(due_type IN (1, 2)),
quick_consume_amount REAL NOT NULL DEFAULT 1,
show_on_stock_overview TINYINT NOT NULL DEFAULT 1 CHECK(show_on_stock_overview IN (0, 1)),
hide_on_stock_overview TINYINT NOT NULL DEFAULT 0 CHECK(hide_on_stock_overview IN (0, 1)),
row_created_timestamp DATETIME DEFAULT (datetime('now', 'localtime'))
);

View File

@ -38,7 +38,7 @@ FROM (
) sc
LEFT JOIN products p
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;
WHERE p.hide_on_stock_overview = 0;
CREATE VIEW uihelper_stock_current_overview
AS
@ -80,4 +80,4 @@ FROM (
) sc
LEFT JOIN products p
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;
WHERE p.hide_on_stock_overview = 0;

View File

@ -44,7 +44,7 @@ LEFT JOIN products_last_purchased plp
ON sc.product_id = plp.product_id
LEFT JOIN products p
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;
WHERE p.hide_on_stock_overview = 0;
DROP VIEW uihelper_stock_current_overview;
CREATE VIEW uihelper_stock_current_overview
@ -92,4 +92,4 @@ LEFT JOIN products_last_purchased plp
ON sc.product_id = plp.product_id
LEFT JOIN products p
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;
WHERE p.hide_on_stock_overview = 0;

View File

@ -62,19 +62,6 @@
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input @if($mode=='create'
)
checked
@elseif($mode=='edit'
&&
$product->show_on_stock_overview == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="show_on_stock_overview" name="show_on_stock_overview" value="1">
<label class="form-check-label custom-control-label"
for="show_on_stock_overview">{{ $__t('Show on stock overview page') }}</label>
</div>
</div>
@php $prefillById = ''; if($mode=='edit') { $prefillById = $product->parent_product_id; } @endphp
@php
$hint = '';
@ -413,6 +400,22 @@
'entity' => 'products'
))
<div class="form-group">
<div class="custom-control custom-checkbox">
<input @if($mode=='create'
)
checked
@elseif($mode=='edit'
&&
$product->hide_on_stock_overview == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="hide_on_stock_overview" name="hide_on_stock_overview" value="1">
<label class="form-check-label custom-control-label"
for="hide_on_stock_overview">{{ $__t('Never show on stock overview') }}&nbsp;<i class="fas fa-question-circle text-muted"
data-toggle="tooltip"
title="{{ $__t('The stock overview page lists all products which are currently in-stock or below their min. stock amount - enable this to hide this product there always') }}"></i>
</label>
</div>
</div>
<small id="save-hint"
class="my-2 form-text text-muted @if($mode == 'edit') d-none @endif">{{ $__t('Save & continue to add quantity unit conversions & barcodes') }}</small>