fix: refs #7524 backSuppliersPackaging
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-10-07 08:00:34 +02:00
parent 52e8bac168
commit e90d48c777
2 changed files with 7 additions and 1 deletions

View File

@ -15,12 +15,17 @@ module.exports = Self => {
Self.getWithPackaging = async options => {
const models = Self.app.models;
const myOptions = {};
const oneYearAgo = new Date();
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
if (typeof options == 'object')
Object.assign(myOptions, options);
const entries = await models.Entry.find({
where: {typeFk: 'packaging'},
where: {
typeFk: 'packaging',
created: {gte: oneYearAgo}
},
include: {
relation: 'supplier',
scope: {

View File

@ -18,6 +18,7 @@ describe('Supplier getWithPackaging()', () => {
await entry.updateAttributes({
typeFk: typeFk,
created: new Date()
});
const result = await models.Supplier.getWithPackaging(myOptions);