item descriptor not sending the correct warehouse fixed
gitea/salix/dev This commit looks good Details

This commit is contained in:
Gerard 2019-02-20 11:30:55 +01:00
parent 20843a9068
commit 0f5d1e55c0
2 changed files with 7 additions and 6 deletions

View File

@ -23,11 +23,11 @@ module.exports = Self => {
}
});
Self.getVisibleAvailable = async(itemFk, warehouseFk) => {
Self.getVisibleAvailable = async(id, warehouseFk) => {
let query = `
CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`;
let options = [itemFk, warehouseFk, false];
let options = [id, warehouseFk, false];
[res] = await Self.rawSql(query, options);
return {

View File

@ -34,20 +34,21 @@ class Controller {
set item(value) {
this._item = value;
this.updateStock();
if (value && value.itemType && value.itemType.warehouseFk)
this.updateStock(value.itemType.warehouseFk);
}
get item() {
return this._item;
}
updateStock() {
updateStock(warehouseFk) {
this.available = null;
this.visible = null;
if (this._item && this._item.id) {
let options = {
params: {
warehouseFk: this._warehouseFk
warehouseFk: warehouseFk
}
};
this.$http.get(`/item/api/Items/${this._item.id}/getVisibleAvailable`, options).then(response => {
@ -81,7 +82,7 @@ class Controller {
warehouseFk: this.warehouseFk
}).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.updateStock();
this.updateStock(this.item.itemType.warehouseFk);
});
}
}