fix(Items): Not display inactive items in sales and purchases.

fix(item): Prevent edit inventory account of item once item has transactions.
This commit is contained in:
a.bouhuolia
2021-03-24 11:10:58 +02:00
parent 96f20bf51b
commit 8646f3dcf9
5 changed files with 64 additions and 6 deletions

View File

@@ -512,9 +512,19 @@ export default class ItemsController extends BaseController {
errors: [{
type: 'TYPE_CANNOT_CHANGE_WITH_ITEM_HAS_TRANSACTIONS',
message: 'Cannot change item type to inventory with item has associated transactions.',
code: 350,
}],
});
}
if (error.errorType === 'INVENTORY_ACCOUNT_CANNOT_MODIFIED') {
return res.status(400).send({
errors: [{
type: 'INVENTORY_ACCOUNT_CANNOT_MODIFIED',
message: 'Cannot change item inventory account while the item has transactions.',
code: 360,
}]
})
}
}
next(error);
}