1684 - Log old quantity value
gitea/salix/1684-ticket_transfer_salesLog This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-11 08:19:03 +01:00
parent e1942875af
commit 91210c3a0d
2 changed files with 17 additions and 15 deletions

View File

@ -157,9 +157,9 @@ module.exports = Self => {
// Update original sale
const rest = originalSale.quantity - sale.quantity;
const updatedSale = await models.Sale.updateAll({
id: sale.id
}, {quantity: rest}, options);
const originalInstance = await models.Sale.findById(sale.id, options);
await originalInstance.updateAttribute('quantity', rest, options);
// Clone sale with new quantity
const newSale = originalSale;
newSale.id = undefined;
@ -180,6 +180,6 @@ module.exports = Self => {
await models.SaleComponent.create(newComponents, options);
return updatedSale;
return originalInstance;
}
};

View File

@ -323,17 +323,19 @@
</tr>
</tbody>
</table>
<vn-horizontal class="vn-py-md">
<vn-input-number vn-none
label="Transfer to ticket"
ng-model="$ctrl.transfer.ticketId"
type="number">
</vn-input-number>
<vn-icon-button vn-none
icon="arrow_forward_ios"
ng-click="$ctrl.transferSales($ctrl.transfer.ticketId)">
</vn-icon-button>
</vn-horizontal>
<form name="form">
<vn-horizontal class="vn-py-md">
<vn-input-number vn-one
label="Transfer to ticket"
ng-model="$ctrl.transfer.ticketId"
type="number">
</vn-input-number>
<vn-icon-button vn-none
icon="arrow_forward_ios"
ng-click="$ctrl.transferSales($ctrl.transfer.ticketId)">
</vn-icon-button>
</vn-horizontal>
</form>
<vn-horizontal class="vn-py-md">
<vn-button
label="New ticket"