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

View File

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