removed unused relation from item @addSale
This commit is contained in:
parent
5eb0ab8296
commit
2494af0113
|
@ -44,8 +44,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
const res = await models.Item.getVisibleAvailable(itemId, ticket.warehouseFk, ticket.shipped);
|
const res = await models.Item.getVisibleAvailable(itemId, ticket.warehouseFk, ticket.shipped);
|
||||||
|
|
||||||
const packagingFamily = item.family == 'EMB';
|
const isPackaging = item.family == 'EMB';
|
||||||
if (!packagingFamily && res.available < quantity)
|
if (!isPackaging && res.available < quantity)
|
||||||
throw new UserError(`This item is not available`);
|
throw new UserError(`This item is not available`);
|
||||||
|
|
||||||
const newSale = await models.Sale.create({
|
const newSale = await models.Sale.create({
|
||||||
|
@ -59,15 +59,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const sale = await models.Sale.findById(newSale.id, {
|
const sale = await models.Sale.findById(newSale.id, {
|
||||||
include: {
|
include: {
|
||||||
relation: 'item',
|
relation: 'item'
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'packaging',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'price']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue