mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
2c0540bfd5
- add basic inventory schemas - add basic inventory models - patch stockmovement number series
30 lines
661 B
TypeScript
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,
|
|
};
|
|
}
|