Merge pull request '3290-entry_last-buys add filter isFloramondo' (#797) from 3290-entry_latest-buys into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #797
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-11-22 15:39:15 +00:00
commit 6dc373677d
6 changed files with 41 additions and 3 deletions

View File

@ -806,7 +806,7 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0), (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0),
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0), (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0),
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0), (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0),
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 0), (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1),
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0), (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0),
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0), (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0),
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0), (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0),

View File

@ -54,6 +54,11 @@ module.exports = Self => {
type: 'boolean', type: 'boolean',
description: 'Whether the item is or not visible', description: 'Whether the item is or not visible',
}, },
{
arg: 'floramondo',
type: 'boolean',
description: 'Whether the item is or not floramondo',
},
{ {
arg: 'typeFk', arg: 'typeFk',
type: 'integer', type: 'integer',
@ -110,6 +115,8 @@ module.exports = Self => {
return {'it.code': value}; return {'it.code': value};
case 'active': case 'active':
return {'i.isActive': value}; return {'i.isActive': value};
case 'floramondo':
return {'i.isFloramondo': value};
case 'visible': case 'visible':
if (value) if (value)
return {'v.visible': {gt: 0}}; return {'v.visible': {gt: 0}};

View File

@ -113,6 +113,30 @@ describe('Buy latests buys filter()', () => {
expect(results.length).toBe(0); expect(results.length).toBe(0);
}); });
it('should return results matching "floramondo"', async() => {
let ctx = {
args: {
floramondo: true
}
};
let results = await app.models.Buy.latestBuysFilter(ctx);
expect(results.length).toBe(1);
});
it('should return results matching "not floramondo"', async() => {
let ctx = {
args: {
floramondo: false
}
};
let results = await app.models.Buy.latestBuysFilter(ctx);
expect(results.length).toBe(5);
});
it('should return results matching "salesPersonFk"', async() => { it('should return results matching "salesPersonFk"', async() => {
let ctx = { let ctx = {
args: { args: {

View File

@ -69,6 +69,11 @@
ng-model="filter.visible" ng-model="filter.visible"
triple-state="true"> triple-state="true">
</vn-check> </vn-check>
<vn-check
label="Is floramondo"
ng-model="filter.floramondo"
triple-state="true">
</vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal class="vn-pt-sm"> <vn-horizontal class="vn-pt-sm">
<vn-one class="text-subtitle1" translate> <vn-one class="text-subtitle1" translate>

View File

@ -4,6 +4,8 @@ Freight value: Porte
Commission value: Comisión Commission value: Comisión
Package value: Embalaje Package value: Embalaje
Is ignored: Ignorado Is ignored: Ignorado
Is visible: Visible
Is floramondo: Floramondo
Grouping price: Precio grouping Grouping price: Precio grouping
Packing price: Precio packing Packing price: Precio packing
Min price: Precio min Min price: Precio min

View File

@ -70,8 +70,8 @@ describe('item filter()', () => {
const ctx = {args: {filter: filter, isFloramondo: true}}; const ctx = {args: {filter: filter, isFloramondo: true}};
const result = await models.Item.filter(ctx, filter, options); const result = await models.Item.filter(ctx, filter, options);
expect(result.length).toEqual(2); expect(result.length).toEqual(3);
expect(result[0].id).toEqual(13); expect(result[0].id).toEqual(9);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {