Tarea #600 Refactor to make it compatible with logs
This commit is contained in:
parent
a607ac9efb
commit
5eb83ed01e
|
@ -1,5 +1,5 @@
|
||||||
module.exports = function(Client) {
|
module.exports = function(Self) {
|
||||||
Client.remoteMethod('addressesPropagateRe', {
|
Self.remoteMethod('addressesPropagateRe', {
|
||||||
description: 'Change property isEqualizated in all client addresses',
|
description: 'Change property isEqualizated in all client addresses',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
@ -29,10 +29,11 @@ module.exports = function(Client) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Client.addressesPropagateRe = async (id, data) => {
|
Self.addressesPropagateRe = async (id, data) => {
|
||||||
if (data.hasOwnProperty('isEqualizated')) {
|
if (data.hasOwnProperty('isEqualizated')) {
|
||||||
await Client.app.models.Address.updateAll({clientFk: id}, data);
|
await Self.app.models.Address.updateAll({clientFk: id}, data);
|
||||||
await Client.update({id: id}, {hasToInvoiceByAddress: false});
|
let client = await Self.app.models.Client.findById(id)
|
||||||
|
await client.updateAttributes({hasToInvoiceByAddress: false});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue