mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-30 12:45:42 +00:00
Default stock currency (#10641)
* Fix for useStockFields - Use default currency * Ensure default currency is observed * Specify field default * Improve import (for ty) * Update migration files - Point currency fields to the correct default method * Unit tests - Ensure stock item gets correct default currency * Cleaner generation of default currency value - Return empty string during migratoins * Update existing migrations * Reduce noise * Ignore "no-matching-overload" rule for ty * Tweak money_kwargs
This commit is contained in:
@@ -124,10 +124,18 @@ export function useStockFields({
|
||||
}
|
||||
}, [pricing, quantity]);
|
||||
|
||||
// Set the supplier part if provided
|
||||
useEffect(() => {
|
||||
if (supplierPartId && !supplierPart) setSupplierPart(supplierPartId);
|
||||
}, [partInstance, supplierPart, supplierPartId]);
|
||||
|
||||
// Set default currency from global settings
|
||||
useEffect(() => {
|
||||
setPurchasePriceCurrency(
|
||||
globalSettings.getSetting('INVENTREE_DEFAULT_CURRENCY')
|
||||
);
|
||||
}, [globalSettings]);
|
||||
|
||||
return useMemo(() => {
|
||||
const fields: ApiFormFieldSet = {
|
||||
part: {
|
||||
@@ -248,6 +256,7 @@ export function useStockFields({
|
||||
},
|
||||
purchase_price_currency: {
|
||||
icon: <IconCoins />,
|
||||
default: globalSettings.getSetting('INVENTREE_DEFAULT_CURRENCY'),
|
||||
value: purchasePriceCurrency,
|
||||
onValueChange: (value) => {
|
||||
setPurchasePriceCurrency(value);
|
||||
|
||||
Reference in New Issue
Block a user