Merge pull request '3586-claim_filter and non ECMA compatible bugs' (#870) from 3586-claim_filter into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #870
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2022-02-03 09:49:19 +00:00
commit 5c75050e11
4 changed files with 9 additions and 5 deletions

View File

@ -94,7 +94,7 @@ describe('Ticket Edit basic data path', () => {
it(`should split ticket without negatives`, async() => {
const newAgency = 'Silla247';
const newDate = new Date();
newDate.setDate(newDate.getDate() + 1);
newDate.setDate(newDate.getDate() - 1);
await page.accessToSearchResult('14');
await page.accessToSection('ticket.card.basicData.stepOne');

View File

@ -82,6 +82,7 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
let to;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -109,7 +110,11 @@ module.exports = Self => {
case 'attenderFk':
return {'cl.workerFk': value};
case 'created':
return {'cl.created': value};
value.setHours(0, 0, 0, 0);
to = new Date(value);
to.setHours(23, 59, 59, 999);
return {'cl.created': {between: [value, to]}};
}
});

View File

@ -138,9 +138,8 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
const [salesMovable] = await Self.rawSql(query, params, myOptions);
const saleMovable = sale.movable ? sale.movable : 0;
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
const salesNewTicket = salesMovable.filter(sale => saleMovable >= sale.quantity);
if (salesNewTicket.length) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;

View File

@ -112,7 +112,7 @@ module.exports = Self => {
// Get items movable
const ticketOrigin = await models.Ticket.findById(args.id, null, myOptions);
const differenceShipped = ticketOrigin.shipped.getTime() != args.shipped.getTime();
const differenceShipped = ticketOrigin.shipped.getTime() > args.shipped.getTime();
const differenceWarehouse = ticketOrigin.warehouseFk != args.warehouseId;
salesObj.haveDifferences = differenceShipped || differenceWarehouse;