Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 231401_master_to_test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
1842a5c464
|
@ -66,7 +66,6 @@
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
<vn-pagination model="model"></vn-pagination>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-data-viewer>
|
</vn-data-viewer>
|
||||||
<vn-worker-descriptor-popover vn-id="workerDescriptor">
|
<vn-worker-descriptor-popover vn-id="workerDescriptor">
|
||||||
|
|
|
@ -68,7 +68,9 @@
|
||||||
<th field="stateFk">
|
<th field="stateFk">
|
||||||
<span translate>State</span>
|
<span translate>State</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="isFragile"></th>
|
<th field="isFragile" number>
|
||||||
|
<span translate>Fragile</span>
|
||||||
|
</th>
|
||||||
<th field="zoneFk">
|
<th field="zoneFk">
|
||||||
<span translate>Zone</span>
|
<span translate>Zone</span>
|
||||||
</th>
|
</th>
|
||||||
|
|
|
@ -30,35 +30,47 @@ module.exports = Self => {
|
||||||
const ticketLogs = await models.TicketLog.find(
|
const ticketLogs = await models.TicketLog.find(
|
||||||
{
|
{
|
||||||
where: {
|
where: {
|
||||||
and: [
|
or: [
|
||||||
{originFk: id},
|
{
|
||||||
{action: 'update'},
|
and: [
|
||||||
{changedModel: 'Sale'}
|
{originFk: id},
|
||||||
|
{action: 'update'},
|
||||||
|
{changedModel: 'Sale'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
and: [
|
||||||
|
{originFk: id},
|
||||||
|
{action: 'delete'},
|
||||||
|
{changedModel: 'Sale'}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
'oldInstance',
|
'oldInstance',
|
||||||
'newInstance',
|
'newInstance',
|
||||||
'changedModelId'
|
'changedModelId',
|
||||||
|
'changedModelValue'
|
||||||
],
|
],
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const changes = [];
|
const changes = [];
|
||||||
for (const ticketLog of ticketLogs) {
|
|
||||||
const oldQuantity = ticketLog.oldInstance.quantity;
|
for (const log of ticketLogs) {
|
||||||
const newQuantity = ticketLog.newInstance.quantity;
|
const oldQuantity = log.oldInstance.quantity;
|
||||||
|
const newQuantity = log.newInstance?.quantity || 0;
|
||||||
|
|
||||||
if (oldQuantity || newQuantity) {
|
if (oldQuantity || newQuantity) {
|
||||||
const sale = await models.Sale.findById(ticketLog.changedModelId, null, myOptions);
|
const changeMessage = $t('Change quantity', {
|
||||||
const message = $t('Change quantity', {
|
concept: log.changedModelValue,
|
||||||
concept: sale.concept,
|
oldQuantity: oldQuantity || 0,
|
||||||
oldQuantity: oldQuantity || 0,
|
newQuantity: newQuantity || 0,
|
||||||
newQuantity: newQuantity || 0,
|
});
|
||||||
});
|
changes.push(changeMessage);
|
||||||
|
|
||||||
changes.push(message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return changes.join('\n');
|
return changes.join('\n');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue