mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
26 lines
585 B
TypeScript
26 lines
585 B
TypeScript
import { Doc } from 'fyo/model/doc';
|
|
import type { FormulaMap } from 'fyo/model/types';
|
|
import { ModelNameEnum } from 'models/types';
|
|
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'],
|
|
},
|
|
};
|
|
}
|