refactor(manifestLines): standardize on taxrate and change schema type to float
This commit is contained in:
@@ -333,14 +333,14 @@ type DeliveryLine = {
|
||||
amount: number,
|
||||
net: number,
|
||||
rebate: number,
|
||||
tax: number, // manifestarticle.taxrate
|
||||
taxrate: number, // manifestarticle.taxrate
|
||||
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 `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`.
|
||||
`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`, `taxrate` (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`.
|
||||
|
||||
@@ -377,7 +377,7 @@ type ManifestLine = {
|
||||
amount: number,
|
||||
net: number,
|
||||
rebate: number,
|
||||
tax: number, // tax.rate
|
||||
taxrate: number, // tax.rate
|
||||
comment: string | null,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user