fixes #4564 que reports maneje si el origen de datos no devuelve registros #1266

Merged
alexandre merged 8 commits from 4564-report_eror-handler into dev 2023-01-27 06:46:41 +00:00
5 changed files with 16 additions and 38 deletions
Showing only changes of commit dc528722bd - Show all commits

View File

@ -157,7 +157,7 @@ class Controller extends Section {
* Apply order to model * Apply order to model
*/ */
applyOrder() { applyOrder() {
if (this.typeId || this.tagGroups.length > 0) if (this.typeId || this.tagGroups.length > 0 || this.itemName)
this.$.model.addFilter(null, {orderBy: this.getOrderBy()}); this.$.model.addFilter(null, {orderBy: this.getOrderBy()});
} }

View File

@ -36,7 +36,7 @@ module.exports = Self => {
st.originalQuantity, st.originalQuantity,
st.created, st.created,
st.workerFk, st.workerFk,
u.nickname userNickname, u.name,
ste.name AS state ste.name AS state
FROM saleTracking st FROM saleTracking st
JOIN sale s ON s.id = st.saleFk JOIN sale s ON s.id = st.saleFk
@ -48,24 +48,6 @@ module.exports = Self => {
const trackings = await Self.rawStmt(stmt, myOptions); const trackings = await Self.rawStmt(stmt, myOptions);
const salesFilter = {
include: [
{
relation: 'item'
}
],
where: {ticketFk: filter.where.ticketFk}
};
const sales = await Self.app.models.Sale.find(salesFilter, myOptions);
for (const tracking of trackings) {
for (const sale of sales) {
if (tracking.itemFk == sale.itemFk)
tracking.item = sale.item();
}
}
return trackings; return trackings;
}; };
}; };

View File

@ -30,12 +30,12 @@
<span class="chip {{$ctrl.chipIsControled(sale.preparingList.isControled)}} vn-mx-xs" vn-tooltip="is controled"></span> <span class="chip {{$ctrl.chipIsControled(sale.preparingList.isControled)}} vn-mx-xs" vn-tooltip="is controled"></span>
</vn-td> </vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="$ctrl.showItemDescriptor($event, sale)" ng-click="itemDescriptor.show($event, sale.item.id)"
class="link"> class="link">
{{::sale.itemFk | zeroFill:6}} {{::sale.item.id}}
</span> </span>
</vn-td> </vn-td>
<vn-td vn-fetched-tags> <vn-td vn-fetched-tags>
<div> <div>
<vn-one title="{{::sale.item.name}}">{{::sale.item.name}}</vn-one> <vn-one title="{{::sale.item.name}}">{{::sale.item.name}}</vn-one>
@ -96,27 +96,23 @@
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in saleTrackings"> <vn-tr ng-repeat="saleTracking in saleTrackings">
<vn-td number>{{::sale.quantity}}</vn-td> <vn-td number>{{::saleTracking.quantity}}</vn-td>
<vn-td number>{{::sale.originalQuantity}}</vn-td> <vn-td number>{{::saleTracking.originalQuantity}}</vn-td>
<vn-td expand> <vn-td expand>
<span <span
class="link" class="link"
ng-click="workerDescriptor.show($event, sale.workerFk)"> ng-click="workerDescriptor.show($event, saleTracking.workerFk)">
{{::sale.userNickname | dashIfEmpty}} {{::saleTracking.name | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td shrink>{{::sale.state}}</vn-td> <vn-td shrink>{{::saleTracking.state}}</vn-td>
<vn-td expand>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td> <vn-td expand>{{::saleTracking.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
</vn-table> </vn-table>
</vn-card> </vn-card>
</vn-data-viewer> </vn-data-viewer>
<vn-item-descriptor-popover
vn-id="item-descriptor"
warehouse-fk="$ctrl.ticket.warehouseFk">
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="worker-descriptor"> vn-id="worker-descriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -45,14 +45,14 @@ class Controller extends Section {
btnThree: { btnThree: {
icon: 'icon-transaction', icon: 'icon-transaction',
state: `item.card.diary({ state: `item.card.diary({
id: ${sale.itemFk}, id: ${sale.item.id},
warehouseFk: ${this.ticket.warehouseFk}, warehouseFk: ${this.ticket.warehouseFk},
lineFk: ${sale.id} lineFk: ${sale.id}
})`, })`,
tooltip: 'Item diary' tooltip: 'Item diary'
} }
}; };
this.$.itemDescriptor.show(event.target, sale.itemFk); this.$.itemDescriptor.show(event.target, sale.item.id);
} }
chipHasSaleGroupDetail(hasSaleGroupDetail) { chipHasSaleGroupDetail(hasSaleGroupDetail) {

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "230401", "version": "23.04.01",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "Salix backend", "description": "Salix backend",
"license": "GPL-3.0", "license": "GPL-3.0",