Claim fixes
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2023-03-07 10:20:10 +01:00
parent 44e7abd6d3
commit 445a0b0e1f
2 changed files with 15 additions and 15 deletions

View File

@ -29,21 +29,21 @@ module.exports = Self => {
myOptions.transaction = ctx.options.transaction; myOptions.transaction = ctx.options.transaction;
const claimBeginning = await Self.findById(ctx.where.id); const claimBeginning = await Self.findById(ctx.where.id);
const filter = { const filter = {
where: {id: claimBeginning.claimFk}, where: {id: claimBeginning.claimFk},
include: [ include: [
{ {
relation: 'claimState', relation: 'claimState',
scope: { scope: {
fields: ['id', 'code', 'description'] fields: ['id', 'code', 'description']
} }
} }
] ]
}; };
const [claim] = await models.Claim.find(filter, myOptions); const [claim] = await models.Claim.find(filter, myOptions);
const isEditable = await models.ClaimState.isEditable(httpCtx, claim.ClaimState()); const isEditable = await models.ClaimState.isEditable(httpCtx, claim.claimState().id);
if (!isEditable) if (!isEditable)
throw new UserError(`The current claim can't be modified`); throw new UserError(`The current claim can't be modified`);

View File

@ -100,8 +100,8 @@ class Controller extends Section {
} }
setClaimedQuantity(id, claimedQuantity) { setClaimedQuantity(id, claimedQuantity) {
let params = {id: id, quantity: claimedQuantity}; let params = {quantity: claimedQuantity};
let query = `ClaimBeginnings/`; let query = `ClaimBeginnings/${id}`;
this.$http.patch(query, params).then(() => { this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));
this.calculateTotals(); this.calculateTotals();