quantityDefaults function
Wirksame Regel eines Artikels: die gespeicherte Angabe schlägt die Vorgabe der Einheit.
Implementation
QuantityDefaults quantityDefaults(PosArticle a) {
final v = quantityRuleForUnit(a.unit);
final regel = a.quantityRule ?? v.rule;
return QuantityDefaults(
rule: regel,
ask: a.askQuantity ?? v.ask,
decimals: regel == QuantityRule.decimal ? (v.decimals < 1 ? 2 : v.decimals) : 0,
);
}