2
0
mirror of https://github.com/frappe/books.git synced 2024-11-15 01:44:04 +00:00
books/models/baseModels/PriceList/PriceListItem.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
585 B
TypeScript
Raw Normal View History

import { Doc } from 'fyo/model/doc';
2023-06-07 04:45:26 +00:00
import type { FormulaMap } from 'fyo/model/types';
import { ModelNameEnum } from 'models/types';
2023-06-07 04:45:26 +00:00
import type { Money } from 'pesa';
import type { PriceList } from './PriceList';
export class PriceListItem extends Doc {
item?: string;
unit?: string;
rate?: Money;
parentdoc?: PriceList;
formulas: FormulaMap = {
unit: {
formula: async () => {
if (!this.item) {
return;
}
return await this.fyo.getValue(ModelNameEnum.Item, this.item, 'unit');
},
dependsOn: ['item'],
},
};
}