This commit is contained in:
parent
4a2d61ddcb
commit
4a6ff9ca20
|
@ -134,7 +134,7 @@ module.exports = function(Self) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = recordSet && recordSet.id || val; // FIXME preparar todos los modelos con campo name
|
val = recordSet && recordSet.id || val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,24 +27,3 @@ exports.getFinalState = function(ctx) {
|
||||||
exports.isMultiple = function(ctx) {
|
exports.isMultiple = function(ctx) {
|
||||||
return !ctx.isNewInstance && !ctx.currentInstance;
|
return !ctx.isNewInstance && !ctx.currentInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* exports.fkToValue = async function(instance, ctx, model) {
|
|
||||||
let transaction = ctx.options && ctx.options.transaction;
|
|
||||||
let cleanInstance = JSON.parse(JSON.stringify(instance));
|
|
||||||
let result = {};
|
|
||||||
for (let key in cleanInstance) {
|
|
||||||
let val = cleanInstance[key];
|
|
||||||
if (val === undefined || val === null) continue;
|
|
||||||
for (let key1 in model.relations) {
|
|
||||||
let val1 = model.relations[key1];
|
|
||||||
if (val1.keyFrom == key && key != 'id') {
|
|
||||||
let recordSet = await val1.modelTo.findById(val, {}, {transaction});
|
|
||||||
val = recordSet.name || recordSet.id; // FIXME preparar todos los modelos con campo name
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result[key] = val;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
Self.validateBinded('credit', Self.validateCredit, {
|
Self.validateBinded('credit', Self.validateCredit, {
|
||||||
message: 'The credit must be an integer greater than or equal to zero',
|
message: 'The credit must be an integer greater than or equal to zero',
|
||||||
allowNull: false, // FIXME: Ignored by loopback when it's false
|
allowNull: false,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
||||||
Self.regenerate = async(ctx, id) => {
|
Self.regenerate = async(ctx, id) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const invoiceReportFk = 30; // FIXME - Should be deprecated
|
const invoiceReportFk = 30; // Should be deprecated
|
||||||
const worker = await models.Worker.findOne({where: {userFk: userId}});
|
const worker = await models.Worker.findOne({where: {userFk: userId}});
|
||||||
const tx = await Self.beginTransaction({});
|
const tx = await Self.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('invoiceOut regenerate()', () => {
|
describe('invoiceOut regenerate()', () => {
|
||||||
const invoiceReportFk = 30; // FIXME - Should be deprecated
|
const invoiceReportFk = 30;
|
||||||
const invoiceOutId = 1;
|
const invoiceOutId = 1;
|
||||||
|
|
||||||
afterAll(async done => {
|
afterAll(async done => {
|
||||||
|
|
|
@ -105,7 +105,6 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
<!-- FIXME - APPLY CSS POST-RENDER -->
|
|
||||||
<tr >
|
<tr >
|
||||||
<td colspan="7"></td>
|
<td colspan="7"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue