main stocks update
This commit is contained in:
@@ -800,7 +800,13 @@ export interface CreateProductLocationInput {
|
||||
|
||||
/** POST /products/createproductlocation — Add a product to a store catalogue / inventory. (Expects array payload) */
|
||||
export async function createProductLocation(input: CreateProductLocationInput): Promise<Row> {
|
||||
const payload = {
|
||||
// The selling price field is `price` — it binds to models.Productlocations
|
||||
// .Price, and CreateProductLocation's upsert lists "price" in its
|
||||
// DoUpdates, so this both inserts and updates the per-store price.
|
||||
// (`retailprice` is the MASTER price on the products table; that struct
|
||||
// ignores it, so sending it here persisted nothing.) Only send when a price
|
||||
// was supplied, so a quantity-only write can't blank an existing one.
|
||||
const payload: Record<string, unknown> = {
|
||||
tenantid: input.tenantid,
|
||||
locationid: input.locationid,
|
||||
productid: input.productid,
|
||||
@@ -808,6 +814,7 @@ export async function createProductLocation(input: CreateProductLocationInput):
|
||||
stocktype: input.stocktype || 'in',
|
||||
status: input.status || 'Active',
|
||||
};
|
||||
if (num(input.price) > 0) payload.price = input.price;
|
||||
return fiestaSend<Row>('products/createproductlocation', 'POST', [payload]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user