saveInventoryWriteOff

Create an Inventory Write-Off or update an existing one.

Inventory Write-Off is a document that removes products from inventory; it has a list of items and quantities.

Non-stock products and bundles cannot be on Inventory Write-Offs (these items do not have inventory).

Products can be added to stock with Inventory Registrations (see getInventoryRegistrations and saveInventoryRegistration) and moved between locations with Inventory Transfers (see getInventoryTransfers and saveInventoryTransfer).

To retrieve a list of Inventory Write-Offs, see getInventoryWriteOffs.

Input parameters

Parameter name Description Possible value Required
inventoryWriteOffID Inventory write-off ID.
Set this parameter to update an existing Inventory Write-Off.

If the Erply account has upgraded inventory module (indicated by the (i) signifier at the lower right corner, after version number, in Erply backend), and the write-off is already in confirmed status, it is no longer possible to change:
  • warehouseID
  • currencyCode
  • document rows.
API will return error 1017 if you attempt to change any of those fields.
integer
creatorID Company user unique ID integer
reasonID ID of the reason. See getReasonCodes. integer yes
warehouseID ID of the warehouse integer yes
stocktakingID ID of the inventory stocktaking act, returns error 1186 if provided inventory stocktaking is already connected with inventory write-off. integer
recipientID ID of the recipient of goods integer
currencyCode Currency code: EUR, USD. Currency must be present in the system.
If omitted, default currency will be used.
string
date eg. 2010-01-29
If omitted, current date will be used. Format: yyyy-mm-dd.
string
comments string
confirmed By default 1 0 or 1
***** Document lines (rows). Send document lines as a flat list, each line defined by the following set of parameters. Replace # with set number (1, 2, 3, ...). For example: productID1, amount1, price1 for the first Inventory Write-Off row, productID2, amount2, price2 for the second one and so on.
stableRowID# Stable ID of the inventory write-off row. integer
productID# Product ID for this document line. integer yes
amount# Amount for this document line number yes
price# Unit cost. NB! It is typically unnecessary to set this field, because Erply removes items from stock according to FIFO principle (items are subtracted from the oldest batch currently in stock) and the cost is taken automatically from that batch. Decimal
***** Additional attributes associated with this item.

Attributes must be supplied as a flat list, each attribute defined by the following set of three parameters. Replace # with set number (1, 2, 3, ...). When updating an existing entry, API will only update the attributes specified in input data and leave all other existing attributes unchanged. To delete an attribute, set its value to 'null' or 'undefined'.
attributeName# Attribute name. Name can only contain the following symbols: A-Z, a-z, 0-9, dash and underscore. string
attributeType# Attribute type, possible types are 'text', 'int' and 'double'. By default 'text'. string
attributeValue# Value of the attribute. Set value to 'null' or 'undefined' to delete an attribute.
'text' attribute can be any string, maximum 255 characters.
'int' must be a signed 32-bit integer.
'double' must be a decimal number.
string

Response

Field name Type Description
inventoryWriteOffID integer ID of the newly-created item