Add line on change item
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-03-13 08:20:30 +01:00
parent b9a482fc37
commit d51356f11b
2 changed files with 6 additions and 4 deletions

View File

@ -118,7 +118,7 @@
show-field="name"
value-field="id"
search-function="$ctrl.itemSearchFunc($search)"
on-change="sale.quantity && $ctrl.onChangeQuantity(sale)"
on-change="$ctrl.onChangeQuantity(sale)"
order="id DESC"
tabindex="1">
<tpl-item>

View File

@ -464,10 +464,12 @@ class Controller {
* Updates the sale quantity for existing instance
*/
onChangeQuantity(sale) {
if (!sale.quantity) return;
if (!sale.id)
this.addSale(sale);
else
this.updateQuantity(sale);
return this.addSale(sale);
this.updateQuantity(sale);
}
/*