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 packagingFamily = item.family == 'EMB';
|
||||
if (!packagingFamily && res.available < quantity)
|
||||
const isPackaging = item.family == 'EMB';
|
||||
if (!isPackaging && res.available < quantity)
|
||||
throw new UserError(`This item is not available`);
|
||||
|
||||
const newSale = await models.Sale.create({
|
||||
|
@ -59,15 +59,7 @@ module.exports = Self => {
|
|||
|
||||
const sale = await models.Sale.findById(newSale.id, {
|
||||
include: {
|
||||
relation: 'item',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'packaging',
|
||||
scope: {
|
||||
fields: ['id', 'price']
|
||||
}
|
||||
}
|
||||
}
|
||||
relation: 'item'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue