Merge pull request 'hotFix: not transfer all sales if all sales is negatives' (!1192) from hotFix_withoutNegatives into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1192
This commit is contained in:
commit
9ab2144008
|
@ -137,9 +137,11 @@ module.exports = Self => {
|
|||
const params = [args.id, args.shipped, args.warehouseFk];
|
||||
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
||||
|
||||
const sales = await models.Sale.find({ticketFk: args.id}, myOptions);
|
||||
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
|
||||
|
||||
if (salesNewTicket.length) {
|
||||
const salesNewTicketLength = salesNewTicket.length;
|
||||
if (salesNewTicketLength && sales.length != salesNewTicketLength) {
|
||||
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
||||
args.id = newTicket.id;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ class Controller extends Component {
|
|||
ticketHaveNegatives() {
|
||||
let haveNegatives = false;
|
||||
let haveNotNegatives = false;
|
||||
this.ticket.withoutNegatives = false;
|
||||
const haveDifferences = this.ticket.sale.haveDifferences;
|
||||
|
||||
this.ticket.sale.items.forEach(item => {
|
||||
|
@ -76,8 +77,9 @@ class Controller extends Component {
|
|||
haveNotNegatives = true;
|
||||
});
|
||||
|
||||
this.ticket.withoutNegatives = true;
|
||||
this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences);
|
||||
if (this.haveNegatives)
|
||||
this.ticket.withoutNegatives = true;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
Loading…
Reference in New Issue