2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-25 16:17:58 +00:00

Fix auto pricing overwriting manual purchase price #10846 (#11411)

* Fix auto pricing overwriting manual purchase price #10846

* Added entry to api_version.py

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
JustusRijke
2026-02-24 02:58:01 +01:00
committed by GitHub
parent 449bd4e5a0
commit 246108e732
3 changed files with 8 additions and 13 deletions

View File

@@ -1,13 +1,16 @@
"""InvenTree API version information.""" """InvenTree API version information."""
# InvenTree API version # InvenTree API version
INVENTREE_API_VERSION = 458 INVENTREE_API_VERSION = 459
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" """Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """ INVENTREE_API_TEXT = """
v459 -> 2026-02-23 : https://github.com/inventree/InvenTree/pull/11411
- Changed PurchaseOrderLine "auto_pricing" default value from true to false
v458 -> 2026-02-22 : https://github.com/inventree/InvenTree/pull/11401 v458 -> 2026-02-22 : https://github.com/inventree/InvenTree/pull/11401
- siwtches token refresh endpoint to use POST instead of GET (upstream allauth change) - Switches token refresh endpoint to use POST instead of GET (upstream allauth change)
v457 -> 2026-02-11 : https://github.com/inventree/InvenTree/pull/10887 v457 -> 2026-02-11 : https://github.com/inventree/InvenTree/pull/10887
- Extend the "auto allocate" wizard API to include tracked items - Extend the "auto allocate" wizard API to include tracked items

View File

@@ -639,7 +639,7 @@ class PurchaseOrderLineItemSerializer(
help_text=_( help_text=_(
'Automatically calculate purchase price based on supplier part data' 'Automatically calculate purchase price based on supplier part data'
), ),
default=True, default=False,
) )
destination_detail = enable_filter( destination_detail = enable_filter(

View File

@@ -113,16 +113,6 @@ export function usePurchaseOrderLineItemFields({
} }
}, [create, part, quantity, priceBreaks]); }, [create, part, quantity, priceBreaks]);
useEffect(() => {
if (autoPricing) {
setPurchasePrice('');
}
}, [autoPricing]);
useEffect(() => {
setAutoPricing(purchasePrice === '');
}, [purchasePrice]);
const fields = useMemo(() => { const fields = useMemo(() => {
const fields: ApiFormFieldSet = { const fields: ApiFormFieldSet = {
order: { order: {
@@ -159,6 +149,7 @@ export function usePurchaseOrderLineItemFields({
purchase_price: { purchase_price: {
icon: <IconCurrencyDollar />, icon: <IconCurrencyDollar />,
value: purchasePrice, value: purchasePrice,
disabled: autoPricing,
placeholder: suggestedPurchasePrice, placeholder: suggestedPurchasePrice,
placeholderAutofill: true, placeholderAutofill: true,
onValueChange: setPurchasePrice onValueChange: setPurchasePrice
@@ -169,6 +160,7 @@ export function usePurchaseOrderLineItemFields({
onValueChange: setPurchasePriceCurrency onValueChange: setPurchasePriceCurrency
}, },
auto_pricing: { auto_pricing: {
default: create !== false,
value: autoPricing, value: autoPricing,
onValueChange: setAutoPricing onValueChange: setAutoPricing
}, },