#6276 createNewWarehouse methods migrated from silex to salix #1850
|
@ -4,4 +4,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
|
||||||
('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'),
|
('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'),
|
||||||
('MachineWorker','add','READ','ALLOW','ROLE','employee'),
|
('MachineWorker','add','READ','ALLOW','ROLE','employee'),
|
||||||
('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee');
|
('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'),
|
||||||
|
('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee');
|
|
@ -10,12 +10,12 @@ module.exports = Self => {
|
||||||
description: 'The sale id'
|
description: 'The sale id'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'stateCode',
|
arg: 'stateCodes',
|
||||||
type: 'string'
|
type: ['string']
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
jorgep marked this conversation as resolved
|
|||||||
type: ['object'],
|
type: 'boolean',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.delete = async(saleFk, stateCode, options) => {
|
Self.delete = async(saleFk, stateCodes, options) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
let tx;
|
let tx;
|
||||||
|
@ -38,20 +38,24 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (stateCode === 'PREPARED') {
|
|
||||||
const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions);
|
const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions);
|
||||||
|
|
||||||
for (let itemShelvingSale of itemShelvingSales)
|
for (let itemShelvingSale of itemShelvingSales)
|
||||||
await itemShelvingSale.destroy(myOptions);
|
await itemShelvingSale.destroy(myOptions);
|
||||||
}
|
|
||||||
|
|
||||||
const state = await models.State.findOne({
|
const states = await models.State.find({
|
||||||
where: {code: stateCode}
|
fields: ['id'],
|
||||||
|
where: {
|
||||||
|
code: {inq: stateCodes}
|
||||||
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
const stateIds = states.map(state => state.id);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
saleFk: saleFk,
|
saleFk: saleFk,
|
||||||
stateFk: state.id
|
stateFk: {inq: stateIds}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const saleTrackings = await models.SaleTracking.find(filter, myOptions);
|
const saleTrackings = await models.SaleTracking.find(filter, myOptions);
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Controller extends Section {
|
||||||
saleTrackingDel(sale, stateCode) {
|
saleTrackingDel(sale, stateCode) {
|
||||||
const params = {
|
const params = {
|
||||||
saleFk: sale.saleFk,
|
saleFk: sale.saleFk,
|
||||||
stateCode: stateCode
|
stateCodes: [stateCode]
|
||||||
};
|
};
|
||||||
this.$http.post(`SaleTrackings/delete`, params).then(() => {
|
this.$http.post(`SaleTrackings/delete`, params).then(() => {
|
||||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
|
|
Loading…
Reference in New Issue
Si no lo requiere sergio especificamente, normalmente con terminar el procedimiento sobra, no hace falta devolver true
Lo quito