mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
fix: getItemPrice logic
This commit is contained in:
parent
341148e326
commit
d84a531c96
@ -363,18 +363,21 @@ export async function getItemPrice(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isUomDependent = await doc.fyo.getValue(
|
const { isUomDependent, enabled, buying, selling } = await doc.fyo.doc.getDoc(
|
||||||
ModelNameEnum.PriceList,
|
ModelNameEnum.PriceList,
|
||||||
doc.priceList,
|
doc.priceList,
|
||||||
'isUomDependent'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(!enabled || doc.isSales && !selling || !doc.isSales && !buying){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const itemPriceQuery = Object.values(
|
const itemPriceQuery = Object.values(
|
||||||
await doc.fyo.db.getAll(ModelNameEnum.ItemPrice, {
|
await doc.fyo.db.getAll(ModelNameEnum.ItemPrice, {
|
||||||
filters: {
|
filters: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
item: doc.item,
|
item: doc.item,
|
||||||
...(doc.isSales ? { selling: true } : { buying: true }),
|
// ...(doc.isSales ? { selling: true } : { buying: true }),
|
||||||
...(doc.batch ? { batch: doc.batch as string } : { batch: null }),
|
...(doc.batch ? { batch: doc.batch as string } : { batch: null }),
|
||||||
},
|
},
|
||||||
fields: ['name', 'unit', 'party', 'batch', 'validFrom', 'validUpto'],
|
fields: ['name', 'unit', 'party', 'batch', 'validFrom', 'validUpto'],
|
||||||
|
Loading…
Reference in New Issue
Block a user