merge
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-09-11 14:18:21 +02:00
commit c344d8088b
3 changed files with 15 additions and 7 deletions

View File

@ -113,10 +113,13 @@ module.exports = Self => {
}
const isTicketEmpty = await models.Ticket.isEmpty(id, options);
if (isTicketEmpty)
await originalTicket.updateAttributes({isDeleted: true}, options);
if (isTicketEmpty) {
await originalTicket.updateAttributes({
isDeleted: true
}, options);
}
if (tx.id) await tx.commit();
await tx.commit();
return {id: ticketId};
} catch (error) {

View File

@ -80,7 +80,7 @@ module.exports = Self => {
fields: ['salesPersonFk']
}
},
});
}, options);
const salesPersonId = ticket.client().salesPersonFk;
const usesMana = await models.WorkerMana.findOne({
where: {
@ -102,10 +102,10 @@ module.exports = Self => {
value: value,
componentFk: componentId}, options);
const updatedSale = models.Sale.update({id: sale.id},
const updatedSale = models.Sale.updateAll({id: sale.id},
{discount: newDiscount}, options);
promises.push([newComponent, updatedSale]);
promises.push(newComponent, updatedSale);
}
await Promise.all(promises);

View File

@ -1,6 +1,11 @@
{
"name": "Sale",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "TicketLog",
"relation": "ticket",
"showField": "concept"
},
"options": {
"mysql": {
"table": "sale"