mirror of
https://github.com/frappe/books.git
synced 2024-11-12 16:36:27 +00:00
fix: validation
This commit is contained in:
parent
890f5aa6bb
commit
9347acc0aa
@ -1,10 +1,7 @@
|
|||||||
import { Doc } from 'fyo/model/doc';
|
import { Doc } from 'fyo/model/doc';
|
||||||
import { Money } from 'pesa';
|
import { Money } from 'pesa';
|
||||||
import { PricingRuleItem } from '../PricingRuleItem/PricingRuleItem';
|
import { PricingRuleItem } from '../PricingRuleItem/PricingRuleItem';
|
||||||
import {
|
import { getIsDocEnabledColumn } from 'models/helpers';
|
||||||
getIsDocEnabledColumn,
|
|
||||||
getPricingRulesConflicts,
|
|
||||||
} from 'models/helpers';
|
|
||||||
import {
|
import {
|
||||||
HiddenMap,
|
HiddenMap,
|
||||||
ListViewSettings,
|
ListViewSettings,
|
||||||
@ -128,20 +125,6 @@ export class PricingRule extends Doc {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
priority: async (value: DocValue) => {
|
|
||||||
const pricingRuleConflicts = await getPricingRulesConflicts(
|
|
||||||
this,
|
|
||||||
value as number
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!pricingRuleConflicts) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new ValidationError(
|
|
||||||
t`Pricing Rules ${pricingRuleConflicts.pricingRule} has the same Priority for the Item ${pricingRuleConflicts.item}.`
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
required: RequiredMap = {
|
required: RequiredMap = {
|
||||||
|
Loading…
Reference in New Issue
Block a user