Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3258-import_buys

This commit is contained in:
Carlos Jimenez Ruiz 2022-02-04 15:25:12 +01:00
commit 9501d93217
25 changed files with 414 additions and 420 deletions

View File

@ -0,0 +1,3 @@
UPDATE salix.defaultViewConfig
SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}'
WHERE tableCode ='itemsIndex';

View File

@ -0,0 +1,26 @@
ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL;
UPDATE `vn`.`state` s
SET s.classColor = 'warning'
WHERE s.alertLevel = 1;
UPDATE `vn`.`state` s
SET s.classColor = 'alert'
WHERE s.alertLevel = 0;
UPDATE `vn`.`state` s
SET s.classColor = 'success'
WHERE s.code LIKE 'OK';
UPDATE `vn`.`state` s
SET s.classColor = 'notice'
WHERE s.code LIKE 'FREE';
UPDATE `vn`.`state` s
SET s.classColor = 'success'
WHERE s.order >= 4
AND (s.alertLevel = 0 OR s.alertLevel = 1);
UPDATE `vn`.`state` s
SET s.classColor = 'warning'
WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED');

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

@ -42,7 +42,7 @@ describe('Entry import, create and edit buys path', () => {
await page.waitForTextInField(selectors.entryBuys.observation, '729-6340 2846');
await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged weapon longbow 2m');
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Melee weapon combat fist 15cm');
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Ranged weapon longbow 2m');
await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Ranged weapon sniper rifle 300mm');
await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Melee weapon heavy shield 1x0.5m');

View File

@ -23,59 +23,207 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-isTooLittle:before {
content: "\e91b";
.icon-100:before {
content: "\e95a";
}
.icon-accessory:before {
content: "\e90a";
}
.icon-account:before {
content: "\e92a";
}
.icon-actions:before {
content: "\e960";
}
.icon-addperson:before {
content: "\e90e";
}
.icon-agency:before {
content: "\e938";
}
.icon-albaran:before {
content: "\e94d";
}
.icon-anonymous:before {
content: "\e930";
}
.icon-apps:before {
content: "\e951";
}
.icon-artificial:before {
content: "\e90b";
}
.icon-attach:before {
content: "\e92e";
}
.icon-barcode:before {
content: "\e971";
}
.icon-basket:before {
content: "\e914";
}
.icon-basketadd:before {
content: "\e913";
}
.icon-bin:before {
content: "\e96f";
}
.icon-botanical:before {
content: "\e972";
}
.icon-bucket:before {
content: "\e97a";
color: #000;
}
.icon-buscaman:before {
content: "\e93b";
}
.icon-buyrequest:before {
content: "\e932";
}
.icon-calc_volum .path1:before {
content: "\e915";
color: rgb(0, 0, 0);
}
.icon-calc_volum .path2:before {
content: "\e916";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path3:before {
content: "\e917";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path4:before {
content: "\e918";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path5:before {
content: "\e919";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path6:before {
content: "\e91a";
margin-left: -1em;
color: rgb(255, 255, 255);
}
.icon-calendar:before {
content: "\e93d";
}
.icon-catalog:before {
content: "\e937";
}
.icon-claims:before {
content: "\e963";
}
.icon-client:before {
content: "\e928";
}
.icon-clone:before {
content: "\e973";
}
.icon-columnadd:before {
content: "\e954";
}
.icon-columndelete:before {
content: "\e953";
}
.icon-components:before {
content: "\e946";
}
.icon-consignatarios:before {
content: "\e93f";
}
.icon-control:before {
content: "\e949";
}
.icon-credit:before {
content: "\e927";
}
.icon-defaulter:before {
content: "\e94b";
}
.icon-deletedTicket:before {
content: "\e935";
}
.icon-deleteline:before {
content: "\e955";
}
.icon-delivery:before {
content: "\e939";
}
.icon-deliveryprices:before {
content: "\e91c";
}
.icon-details:before {
content: "\e961";
}
.icon-dfiscales:before {
content: "\e984";
}
.icon-disabled:before {
content: "\e921";
}
.icon-doc:before {
content: "\e977";
}
.icon-entry:before {
content: "\e934";
}
.icon-exit:before {
content: "\e92f";
}
.icon-eye:before {
content: "\e976";
}
.icon-fixedPrice:before {
content: "\e90d";
}
.icon-flower:before {
content: "\e90c";
}
.icon-frozen:before {
content: "\e900";
}
.icon-Person:before {
content: "\e901";
}
.icon-handmadeArtificial:before {
content: "\e902";
}
.icon-fruit:before {
content: "\e903";
}
.icon-funeral:before {
content: "\e904";
}
.icon-treatments:before {
content: "\e905";
}
.icon-preserved:before {
content: "\e906";
}
.icon-greenery:before {
content: "\e907";
}
.icon-plant:before {
content: "\e908";
.icon-greuge:before {
content: "\e944";
}
.icon-grid:before {
content: "\e980";
}
.icon-handmade:before {
content: "\e909";
}
.icon-accessory:before {
content: "\e90a";
.icon-handmadeArtificial:before {
content: "\e902";
}
.icon-artificial:before {
content: "\e90b";
.icon-headercol:before {
content: "\e958";
}
.icon-flower:before {
content: "\e90c";
.icon-history:before {
content: "\e968";
}
.icon-fixedPrice:before {
content: "\e90d";
.icon-info:before {
content: "\e952";
}
.icon-addperson:before {
content: "\e90e";
.icon-inventory:before {
content: "\e92b";
}
.icon-supplierfalse:before {
content: "\e90f";
}
.icon-invoice-out:before {
content: "\e910";
.icon-invoice:before {
content: "\e923";
}
.icon-invoice-in:before {
content: "\e911";
@ -83,338 +231,174 @@
.icon-invoice-in-create:before {
content: "\e912";
}
.icon-basketadd:before {
content: "\e913";
.icon-invoice-out:before {
content: "\e910";
}
.icon-basket:before {
content: "\e914";
}
.icon-calc_volum .path1:before {
content: "\e915";
}
.icon-calc_volum .path2:before {
content: "\e916";
margin-left: -1em;
}
.icon-calc_volum .path3:before {
content: "\e917";
margin-left: -1em;
}
.icon-calc_volum .path4:before {
content: "\e918";
margin-left: -1em;
}
.icon-calc_volum .path5:before {
content: "\e919";
margin-left: -1em;
}
.icon-calc_volum .path6:before {
content: "\e91a";
margin-left: -1em;
}
.icon-deliveryprices:before {
content: "\e91c";
}
.icon-onlinepayment:before {
content: "\e91d";
}
.icon-risk:before {
content: "\e91e";
}
.icon-noweb:before {
content: "\e91f";
}
.icon-no036:before {
content: "\e920";
}
.icon-inactive:before {
content: "\e921";
}
.icon-unavailable:before {
content: "\e922";
}
.icon-invoice-01:before {
content: "\e923";
}
.icon-invoice:before {
content: "\e924";
}
.icon-supplier:before {
content: "\e925";
}
.icon-client2:before {
content: "\e926";
}
.icon-supplier2:before {
content: "\e927";
}
.icon-client:before {
content: "\e928";
}
.icon-shipment-01:before {
content: "\e929";
}
.icon-inventory:before {
content: "\e92b";
}
.icon-zone:before {
content: "\e92c";
}
.icon-wiki:before {
content: "\e92d";
}
.icon-attach:before {
content: "\e92e";
}
.icon-zone2:before {
content: "\e92f";
}
.icon-anonymous:before {
content: "\e930";
}
.icon-net:before {
content: "\e931";
}
.icon-buyrequest:before {
content: "\e932";
}
.icon-thermometer:before {
content: "\e933";
}
.icon-entry:before {
content: "\e934";
}
.icon-deletedTicket:before {
content: "\e935";
}
.icon-deliveryprices-01:before {
content: "\e936";
}
.icon-catalog:before {
content: "\e937";
}
.icon-agency:before {
content: "\e938";
}
.icon-delivery:before {
content: "\e939";
}
.icon-wand:before {
content: "\e93a";
}
.icon-buscaman:before {
content: "\e93b";
}
.icon-pbx:before {
content: "\e93c";
}
.icon-calendar:before {
content: "\e93d";
}
.icon-splitline:before {
content: "\e93e";
}
.icon-consignatarios:before {
content: "\e93f";
}
.icon-tax:before {
content: "\e940";
}
.icon-notes:before {
content: "\e941";
}
.icon-lines:before {
content: "\e942";
}
.icon-languaje:before {
content: "\e943";
}
.icon-greuge:before {
content: "\e944";
}
.icon-credit:before {
content: "\e945";
}
.icon-components:before {
content: "\e946";
}
.icon-pets:before {
content: "\e947";
}
.icon-linesprepaired:before {
content: "\e948";
}
.icon-control:before {
content: "\e949";
}
.icon-revision:before {
content: "\e94a";
}
.icon-newinvoices:before {
content: "\e94b";
}
.icon-services:before {
content: "\e94c";
}
.icon-newalbaran:before {
content: "\e94d";
}
.icon-solunion:before {
content: "\e94e";
}
.icon-stowaway:before {
content: "\e94f";
}
.icon-exit:before {
content: "\e950";
}
.icon-apps:before {
content: "\e951";
}
.icon-info:before {
content: "\e952";
}
.icon-columndelete:before {
content: "\e953";
}
.icon-columnadd:before {
content: "\e954";
}
.icon-deleteline:before {
content: "\e955";
.icon-isTooLittle:before {
content: "\e91b";
}
.icon-item:before {
content: "\e956";
}
.icon-worker:before {
content: "\e957";
.icon-languaje:before {
content: "\e926";
}
.icon-headercol:before {
content: "\e958";
.icon-lines:before {
content: "\e942";
}
.icon-reserva:before {
content: "\e959";
.icon-linesprepaired:before {
content: "\e948";
}
.icon-100:before {
content: "\e95a";
}
.icon-noweb1:before {
content: "\e95b";
}
.icon-settings1:before {
content: "\e95c";
}
.icon-sign:before {
content: "\e95d";
}
.icon-polizon:before {
content: "\e95e";
}
.icon-solclaim:before {
content: "\e95f";
}
.icon-actions:before {
content: "\e960";
}
.icon-details:before {
content: "\e961";
}
.icon-traceability:before {
content: "\e962";
}
.icon-claims:before {
content: "\e963";
}
.icon-regentry:before {
content: "\e964";
}
.icon-regentry-1:before {
content: "\e965";
}
.icon-transaction:before {
content: "\e966";
}
.icon-history:before {
content: "\e968";
}
.icon-entry:before {
content: "\e969";
.icon-logout:before {
content: "\e936";
}
.icon-mana:before {
content: "\e96a";
}
.icon-ticket:before {
content: "\e96b";
.icon-mandatory:before {
content: "\e97b";
}
.icon-net:before {
content: "\e931";
}
.icon-niche:before {
content: "\e96c";
}
.icon-tags:before {
content: "\e96d";
.icon-no036:before {
content: "\e920";
}
.icon-volume:before {
content: "\e96e";
.icon-noPayMethod:before {
content: "\e905";
}
.icon-bin:before {
content: "\e96f";
.icon-notes:before {
content: "\e941";
}
.icon-splur:before {
content: "\e970";
.icon-noweb:before {
content: "\e91f";
}
.icon-barcode:before {
content: "\e971";
}
.icon-botanical:before {
content: "\e972";
}
.icon-clone:before {
content: "\e973";
}
.icon-photo:before {
content: "\e974";
}
.icon-sms:before {
content: "\e975";
}
.icon-eye:before {
content: "\e976";
}
.icon-doc:before {
content: "\e977";
.icon-onlinepayment:before {
content: "\e91d";
}
.icon-package:before {
content: "\e978";
}
.icon-settings:before {
content: "\e979";
.icon-payment:before {
content: "\e97e";
}
.icon-bucket:before {
content: "\e97a";
.icon-pbx:before {
content: "\e93c";
}
.icon-mandatory:before {
content: "\e97b";
.icon-Person:before {
content: "\e901";
}
.icon-pets:before {
content: "\e947";
}
.icon-photo:before {
content: "\e924";
}
.icon-plant:before {
content: "\e908";
}
.icon-polizon:before {
content: "\e95e";
}
.icon-preserved:before {
content: "\e906";
}
.icon-recovery:before {
content: "\e97c";
}
.icon-payment:before {
content: "\e97e";
.icon-regentry:before {
content: "\e964";
}
.icon-invoices:before {
content: "\e97f";
.icon-reserva:before {
content: "\e959";
}
.icon-grid:before {
content: "\e980";
.icon-revision:before {
content: "\e94a";
}
.icon-logout:before {
content: "\e981";
.icon-risk:before {
content: "\e91e";
}
.icon-services:before {
content: "\e94c";
}
.icon-settings:before {
content: "\e979";
}
.icon-shipment-01:before {
content: "\e929";
}
.icon-sign:before {
content: "\e95d";
}
.icon-sms:before {
content: "\e975";
}
.icon-solclaim:before {
content: "\e95f";
}
.icon-solunion:before {
content: "\e94e";
}
.icon-splitline:before {
content: "\e93e";
}
.icon-splur:before {
content: "\e970";
}
.icon-stowaway:before {
content: "\e94f";
}
.icon-supplier:before {
content: "\e925";
}
.icon-supplierfalse:before {
content: "\e90f";
}
.icon-tags:before {
content: "\e96d";
}
.icon-tax:before {
content: "\e940";
}
.icon-thermometer:before {
content: "\e933";
}
.icon-ticket:before {
content: "\e96b";
}
.icon-ticketAdd:before {
content: "\e945";
}
.icon-traceability:before {
content: "\e962";
}
.icon-transaction:before {
content: "\e966";
}
.icon-treatments:before {
content: "\e922";
}
.icon-unavailable:before {
content: "\e92c";
}
.icon-volume:before {
content: "\e96e";
}
.icon-wand:before {
content: "\e93a";
}
.icon-web:before {
content: "\e982";
}
.icon-albaran:before {
content: "\e983";
.icon-wiki:before {
content: "\e92d";
}
.icon-dfiscales:before {
content: "\e984";
.icon-worker:before {
content: "\e957";
}
.icon-zone:before {
content: "\e943";
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -291,7 +291,8 @@ module.exports = function(Self) {
* @param {*} properties Modified object properties
*/
function removeUnloggable(definition, properties) {
const propList = Object.keys(properties);
const objectCopy = Object.assign({}, properties);
const propList = Object.keys(objectCopy);
const propDefs = new Map();
for (let property in definition.properties) {
@ -302,10 +303,15 @@ module.exports = function(Self) {
for (let property of propList) {
const propertyDef = propDefs.get(property);
const firstChar = property.substring(0, 1);
const isPrivate = firstChar == '$';
if (!propertyDef) return;
if (isPrivate || !propertyDef)
delete properties[property];
if (propertyDef.log === false)
if (!propertyDef) continue;
if (propertyDef.log === false || isPrivate)
delete properties[property];
else if (propertyDef.logValue === false)
properties[property] = null;

View File

@ -218,5 +218,6 @@
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
"You don't have privileges to create pay back": "No tienes permisos para crear un abono"
"You don't have privileges to create pay back": "No tienes permisos para crear un abono",
"The item is required": "El artículo es requerido"
}

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

@ -7,7 +7,7 @@
"menus": {
"main": [
{"state": "client.index", "icon": "person"},
{"state": "client.defaulter.index", "icon": "person"}
{"state": "client.defaulter.index", "icon": "icon-defaulter"}
],
"card": [
{"state": "client.card.basicData", "icon": "settings"},

View File

@ -3,7 +3,7 @@ const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethod('lastItemBuys', {
description: 'Returns a list of buys',
description: 'Returns a list of items from last buys',
accepts: [
{
arg: 'id',
@ -46,7 +46,7 @@ module.exports = Self => {
fields: ['warehouseInFk', 'landed'],
}
}]
});
}, myOptions);
const travel = entry.travel();

View File

@ -161,6 +161,7 @@ module.exports = Self => {
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
pr.name AS producer,
it.name AS typeName,
it.workerFk AS buyerFk,
u.name AS userName,

View File

@ -54,6 +54,9 @@
<th field="active">
<span translate>Active</span>
</th>
<th field="producer">
<span translate>Producer</span>
</th>
<th field="landed">
<span translate>Landed</span>
</th>
@ -122,6 +125,7 @@
ng-model="::item.isActive">
</vn-check>
</td>
<td>{{::item.producer | dashIfEmpty}}</td>
<td shrink-date>{{::item.landed | date:'dd/MM/yyyy'}}</td>
<td>
<vn-horizontal class="buttons">

View File

@ -81,6 +81,8 @@ class Controller extends Section {
return {'intr.description': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'producer':
return {'pr.name': {like: `%${value}%`}};
case 'id':
case 'size':
case 'subname':

View File

@ -133,6 +133,10 @@ module.exports = Self => {
const where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {'t.id': {inq: value}}
: {'t.nickname': {like: `%${value}%`}};
case 'from':
return {'t.shipped': {gte: value}};
case 'to':
@ -190,6 +194,7 @@ module.exports = Self => {
z.hour AS zoneLanding,
z.name AS zoneName,
z.id AS zoneFk,
st.classColor,
TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour,
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour

View File

@ -171,7 +171,7 @@
</span>
<span
ng-show="::!ticket.refFk"
class="chip {{::$ctrl.stateColor(ticket)}}">
class="chip {{::ticket.classColor}}">
{{::ticket.state}}
</span>
</td>

View File

@ -118,17 +118,6 @@ export default class Controller extends Section {
return 'success';
}
stateColor(ticket) {
if (ticket.alertLevelCode === 'OK')
return 'success';
else if (ticket.alertLevelCode === 'FREE')
return 'notice';
else if (ticket.alertLevel === 1)
return 'warning';
else if (ticket.alertLevel === 0)
return 'alert';
}
totalPriceColor(ticket) {
const total = parseInt(ticket.totalWithVat);
if (total > 0 && total < 50)

View File

@ -89,32 +89,6 @@ describe('Component vnMonitorSalesTickets', () => {
});
});
describe('stateColor()', () => {
it('should return "success" when the alertLevelCode property is "OK"', () => {
const result = controller.stateColor({alertLevelCode: 'OK'});
expect(result).toEqual('success');
});
it('should return "notice" when the alertLevelCode property is "FREE"', () => {
const result = controller.stateColor({alertLevelCode: 'FREE'});
expect(result).toEqual('notice');
});
it('should return "warning" when the alertLevel property is "1', () => {
const result = controller.stateColor({alertLevel: 1});
expect(result).toEqual('warning');
});
it('should return "alert" when the alertLevel property is "0"', () => {
const result = controller.stateColor({alertLevel: 0});
expect(result).toEqual('alert');
});
});
describe('totalPriceColor()', () => {
it('should return "warning" when the ticket amount is less than 50€', () => {
const result = controller.totalPriceColor({totalWithVat: '8.50'});

View File

@ -138,7 +138,8 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
const [salesMovable] = await Self.rawSql(query, params, myOptions);
const salesNewTicket = salesMovable.filter(sale => (sale.movable ?? 0) >= sale.quantity);
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
if (salesNewTicket.length) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;
@ -250,7 +251,7 @@ module.exports = Self => {
res.id = args.id;
if (tx) await tx.commit();
return res;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -42,8 +42,7 @@ module.exports = function(Self) {
}, myOptions);
const hasPurchaseRequests = await models.TicketRequest.count({
ticketFk: id,
isOk: true
ticketFk: id
}, myOptions);
const isEmpty = !hasSales && !hasPackages &&

View File

@ -112,9 +112,9 @@ 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;
let query = `CALL ticket_getMovable(?,?,?)`;
@ -122,8 +122,10 @@ module.exports = Self => {
const [salesMovable] = await Self.rawSql(query, params, myOptions);
const itemMovable = new Map();
for (sale of salesMovable)
itemMovable.set(sale.id, sale.movable ?? 0);
for (sale of salesMovable) {
const saleMovable = sale.movable ? sale.movable : 0;
itemMovable.set(sale.id, saleMovable);
}
// Sale price component, one per sale
query = `CALL vn.ticket_priceDifference(?, ?, ?, ?, ?)`;
@ -152,7 +154,7 @@ module.exports = Self => {
}
if (tx) await tx.commit();
return salesObj;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -51,8 +51,8 @@
</table>
<p v-html="$t('wasteDetailLink')"></p>
<div class="external-link vn-pa-sm vn-m-md">
<a href="https://salix.verdnatura.es/#!/item/waste" target="_blank">
https://salix.verdnatura.es/#!/item/waste
<a href="https://salix.verdnatura.es/#!/item/waste/index" target="_blank">
https://salix.verdnatura.es/#!/item/waste/index
</a>
</div>
</div>