feat(schema): rename manifestarticle customname to name, add pu, and use taxrate
This commit is contained in:
@@ -328,18 +328,20 @@ type DeliverySummary = {
|
||||
type DeliveryLine = {
|
||||
id: number,
|
||||
sku: string | null,
|
||||
customname: string | null,
|
||||
name: string | null,
|
||||
pu: number,
|
||||
amount: number,
|
||||
net: number,
|
||||
rebate: number,
|
||||
tax: number, // tax.rate
|
||||
tax: number, // manifestarticle.taxrate (also exposed as taxrate)
|
||||
taxrate: number,
|
||||
comment: string | null,
|
||||
}
|
||||
|
||||
type Delivery = DeliverySummary & { lines: DeliveryLine[] }
|
||||
```
|
||||
|
||||
`create` inserts header + lines in one transaction. The `number` is auto-allocated via `getnextnumberwithprefixandpadding` (`numbers` type `delivery`); supply `externalNumber` for an external (supplier) reference. `supplierId` null or a Lieferanten `entity` of the company (else `Supplier not found`). Each line requires either `sku` or `customname`. For delivery manifests, `sku` points to `articlesupplier.sku`; for quote and order manifests, `sku` points to `article.sku`. Lines are stored without FKs so manifest articles are preserved even if articles or suppliers are deleted. `amount`, `net`, `tax` (rate → `tax.ensure`); `rebate` defaults `0`. Empty/invalid `date` → `Invalid delivery`; bad line payload → `Invalid lines`.
|
||||
`create` inserts header + lines in one transaction. The `number` is auto-allocated via `getnextnumberwithprefixandpadding` (`numbers` type `delivery`); supply `externalNumber` for an external (supplier) reference. `supplierId` null or a Lieferanten `entity` of the company (else `Supplier not found`). Each line requires either `sku` or `name`. For delivery manifests, `sku` points to `articlesupplier.sku`; for quote and order manifests, `sku` points to `article.sku`. Lines are stored without FKs so manifest articles are preserved even if articles or suppliers are deleted. `amount`, `net`, `tax` (rate → `tax.ensure`); `rebate` defaults `0`. Empty/invalid `date` → `Invalid delivery`; bad line payload → `Invalid lines`.
|
||||
|
||||
`update` patches header fields that are present. If `lines` is present, replace-all lines; if omitted, leave lines unchanged. Returns full `Delivery`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user