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