mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-20 22:00:27 -06:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a97b2a39 | ||
|
|
c9a1d9adda | ||
|
|
64fb5c062a |
@@ -15,7 +15,7 @@ root_command() {
|
||||
no_call=${args[--no-call]}
|
||||
dry_run=${args[--dry-run]}
|
||||
|
||||
REQS="wget apt-transport-https"
|
||||
REQS="wget apt-transport-https curl gpg"
|
||||
|
||||
function do_call() {
|
||||
if [[ $dry_run ]]; then
|
||||
|
||||
@@ -5,7 +5,7 @@ publisher=${args[publisher]}
|
||||
no_call=${args[--no-call]}
|
||||
dry_run=${args[--dry-run]}
|
||||
|
||||
REQS="wget apt-transport-https"
|
||||
REQS="wget apt-transport-https curl gpg"
|
||||
|
||||
function do_call() {
|
||||
if [[ $dry_run ]]; then
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.conf import settings
|
||||
from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION
|
||||
|
||||
# InvenTree software version
|
||||
INVENTREE_SW_VERSION = '1.1.5'
|
||||
INVENTREE_SW_VERSION = '1.1.6'
|
||||
|
||||
|
||||
logger = logging.getLogger('inventree')
|
||||
|
||||
@@ -1678,6 +1678,10 @@ class StockAddSerializer(StockAdjustmentSerializer):
|
||||
stock_item = item['pk']
|
||||
quantity = item['quantity']
|
||||
|
||||
if quantity is None or quantity <= 0:
|
||||
# Ignore in this case - no stock to add
|
||||
continue
|
||||
|
||||
# Optional fields
|
||||
extra = {}
|
||||
|
||||
@@ -1703,6 +1707,10 @@ class StockRemoveSerializer(StockAdjustmentSerializer):
|
||||
stock_item = item['pk']
|
||||
quantity = item['quantity']
|
||||
|
||||
# Ignore in this case - no stock to remove
|
||||
if quantity is None or quantity <= 0:
|
||||
continue
|
||||
|
||||
# Optional fields
|
||||
extra = {}
|
||||
|
||||
|
||||
@@ -862,10 +862,17 @@ function stockRemoveFields(items: any[]): ApiFormFieldSet {
|
||||
|
||||
const records = Object.fromEntries(items.map((item) => [item.pk, item]));
|
||||
|
||||
const initialValue = mapAdjustmentItems(items).map((elem) => {
|
||||
return {
|
||||
...elem,
|
||||
quantity: 0
|
||||
};
|
||||
});
|
||||
|
||||
const fields: ApiFormFieldSet = {
|
||||
items: {
|
||||
field_type: 'table',
|
||||
value: mapAdjustmentItems(items),
|
||||
value: initialValue,
|
||||
modelRenderer: (row: TableFieldRowProps) => {
|
||||
const record = records[row.item.pk];
|
||||
|
||||
@@ -902,10 +909,17 @@ function stockAddFields(items: any[]): ApiFormFieldSet {
|
||||
|
||||
const records = Object.fromEntries(items.map((item) => [item.pk, item]));
|
||||
|
||||
const initialValue = mapAdjustmentItems(items).map((elem) => {
|
||||
return {
|
||||
...elem,
|
||||
quantity: 0
|
||||
};
|
||||
});
|
||||
|
||||
const fields: ApiFormFieldSet = {
|
||||
items: {
|
||||
field_type: 'table',
|
||||
value: mapAdjustmentItems(items),
|
||||
value: initialValue,
|
||||
modelRenderer: (row: TableFieldRowProps) => {
|
||||
const record = records[row.item.pk];
|
||||
|
||||
@@ -941,10 +955,12 @@ function stockCountFields(items: any[]): ApiFormFieldSet {
|
||||
|
||||
const records = Object.fromEntries(items.map((item) => [item.pk, item]));
|
||||
|
||||
const initialValue = mapAdjustmentItems(items);
|
||||
|
||||
const fields: ApiFormFieldSet = {
|
||||
items: {
|
||||
field_type: 'table',
|
||||
value: mapAdjustmentItems(items),
|
||||
value: initialValue,
|
||||
modelRenderer: (row: TableFieldRowProps) => {
|
||||
return (
|
||||
<StockOperationsRow
|
||||
|
||||
@@ -332,6 +332,11 @@ test('Stock - Stock Actions', async ({ browser }) => {
|
||||
await page.getByRole('button', { name: 'Scan', exact: true }).click();
|
||||
await page.getByText('Scanned stock item into location').waitFor();
|
||||
|
||||
// Add "zero" stock - ensure the quantity stays the same
|
||||
await launchStockAction('add');
|
||||
await page.getByRole('button', { name: 'Submit' }).click();
|
||||
await page.getByText('Quantity: 123').first().waitFor();
|
||||
|
||||
// Add stock, and change status
|
||||
await launchStockAction('add');
|
||||
await page.getByLabel('number-field-quantity').fill('12');
|
||||
@@ -342,6 +347,11 @@ test('Stock - Stock Actions', async ({ browser }) => {
|
||||
await page.getByText('Unavailable').first().waitFor();
|
||||
await page.getByText('135').first().waitFor();
|
||||
|
||||
// Remove "zero" stock - ensure the quantity stays the same
|
||||
await launchStockAction('remove');
|
||||
await page.getByRole('button', { name: 'Submit' }).click();
|
||||
await page.getByText('Quantity: 135').first().waitFor();
|
||||
|
||||
// Remove stock, and change status
|
||||
await launchStockAction('remove');
|
||||
await page.getByLabel('number-field-quantity').fill('99');
|
||||
|
||||
Reference in New Issue
Block a user