2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00
books/models/inventory/StockMovementItem.ts
18alantom 2c0540bfd5 incr: add enable inventory
- add basic inventory schemas
- add basic inventory models
- patch stockmovement number series
2022-11-07 13:28:35 +05:30

30 lines
661 B
TypeScript

import { Doc } from 'fyo/model/doc';
import { FilterFunction, FiltersMap } from 'fyo/model/types';
import { Money } from 'pesa';
import { QueryFilter } from 'utils/db/types';
const locationFilter: FilterFunction = (doc: Doc) => {
const item = doc.item;
if (!doc.item) {
return {};
}
return { item } as QueryFilter;
};
export class StockMovementItem extends Doc {
name?: string;
item?: string;
fromLocation?: string;
toLocation?: string;
quantity?: number;
rate?: Money;
amount?: Money;
static filters: FiltersMap = {
item: () => ({ trackItem: true }),
toLocation: locationFilter,
fromLocation: locationFilter,
};
}