done
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
3f4e102860
commit
3a3dae179c
|
@ -34,4 +34,5 @@ rules:
|
||||||
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
|
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
|
||||||
space-in-parens: ["error", "never"]
|
space-in-parens: ["error", "never"]
|
||||||
jasmine/no-focused-tests: 0
|
jasmine/no-focused-tests: 0
|
||||||
jasmine/prefer-toHaveBeenCalledWith: 0
|
jasmine/prefer-toHaveBeenCalledWith: 0
|
||||||
|
arrow-spacing: { "before": true, "after": true }
|
|
@ -150,20 +150,20 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`)
|
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CC y Polizas de crédito', NULL, NULL),
|
(1, 'CC y Polizas de crédito', NULL, NULL),
|
||||||
(2, 'Cash', NULL, 'cash'),
|
(2, 'Cash', 'Cash', 'cash'),
|
||||||
(3, 'Credit card', NULL, 'creditCard'),
|
(3, 'Credit card', 'Credit Card', 'creditCard'),
|
||||||
(4, 'Finalcial lines', NULL, NULL),
|
(4, 'Finalcial lines', NULL, NULL),
|
||||||
(5, 'Other products', NULL, NULL),
|
(5, 'Other products', NULL, NULL),
|
||||||
(6, 'Loans', NULL, NULL),
|
(6, 'Loans', NULL, NULL),
|
||||||
(7, 'Leasing', NULL, NULL),
|
(7, 'Leasing', NULL, NULL),
|
||||||
(8, 'Compensations', 'Compensations', 'Compensations');
|
(8, 'Compensations', 'Compensations', 'compensation');
|
||||||
|
|
||||||
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Pay on receipt', '0000000000', 3, 0, 1, 1),
|
(1, 'Pay on receipt', '5720000001', 3, 0, 1, 1),
|
||||||
(2, 'Cash', '1111111111', 2, 0, 1, 1),
|
(2, 'Cash', '5700000001', 2, 0, 1, 1),
|
||||||
(3, 'Compensation', '0000000000', 8, 0, 1, 1);
|
(3, 'Compensation', '4000000000', 8, 0, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -171,5 +171,6 @@
|
||||||
"New ticket request has been created with price": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
"New ticket request has been created with price": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
||||||
"New ticket request has been created": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
"New ticket request has been created": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||||
"That item doesn't exists": "Ese artículo no existe",
|
"That item doesn't exists": "Ese artículo no existe",
|
||||||
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
|
||||||
|
"Compensation account is empty": "La cuenta para compensar esta vacia"
|
||||||
}
|
}
|
|
@ -62,7 +62,10 @@ module.exports = function(Self) {
|
||||||
const bank = await models.Bank.findById(args.bankFk);
|
const bank = await models.Bank.findById(args.bankFk);
|
||||||
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk);
|
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk);
|
||||||
|
|
||||||
if (args.compensationAccount) {
|
if (accountingType.code == 'compensation') {
|
||||||
|
if (!args.compensationAccount)
|
||||||
|
throw new UserError('Compensation account is empty');
|
||||||
|
|
||||||
const supplierCompensation = await models.Supplier.findOne({
|
const supplierCompensation = await models.Supplier.findOne({
|
||||||
where: {
|
where: {
|
||||||
account: args.compensationAccount
|
account: args.compensationAccount
|
||||||
|
@ -92,12 +95,11 @@ module.exports = function(Self) {
|
||||||
],
|
],
|
||||||
options);
|
options);
|
||||||
} else {
|
} else {
|
||||||
const description = `${clientOriginal.id} : ${clientOriginal.nickname} - ${accountingType.receiptDescription}`;
|
const description = `${clientOriginal.id} : ${clientOriginal.socialName} - ${accountingType.receiptDescription}`;
|
||||||
const [xdiarioNew] = await Self.rawSql(
|
const [xdiarioNew] = await Self.rawSql(
|
||||||
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
|
`SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
Date(),
|
|
||||||
bank.account,
|
bank.account,
|
||||||
clientOriginal.accountingAccount,
|
clientOriginal.accountingAccount,
|
||||||
description,
|
description,
|
||||||
|
@ -114,10 +116,9 @@ module.exports = function(Self) {
|
||||||
options);
|
options);
|
||||||
|
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
|
`SELECT xdiario_new(?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
|
||||||
[
|
[
|
||||||
xdiarioNew.ledger,
|
xdiarioNew.ledger,
|
||||||
Date(),
|
|
||||||
clientOriginal.accountingAccount,
|
clientOriginal.accountingAccount,
|
||||||
bank.account,
|
bank.account,
|
||||||
description,
|
description,
|
||||||
|
|
|
@ -38,6 +38,29 @@ describe('Client createReceipt', () => {
|
||||||
await till.destroy();
|
await till.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should throw Compensation account is empty', async() => {
|
||||||
|
const bankFk = 3;
|
||||||
|
let ctx = {
|
||||||
|
args: {
|
||||||
|
clientFk: clientFk,
|
||||||
|
payed: payed,
|
||||||
|
companyFk: companyFk,
|
||||||
|
bankFk: bankFk,
|
||||||
|
amountPaid: amountPaid,
|
||||||
|
description: description
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await app.models.Client.createReceipt(ctx);
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeDefined();
|
||||||
|
expect(error.message).toEqual('Compensation account is empty');
|
||||||
|
});
|
||||||
|
|
||||||
it('should throw Invalid account if compensationAccount does not belongs to a client nor a supplier', async() => {
|
it('should throw Invalid account if compensationAccount does not belongs to a client nor a supplier', async() => {
|
||||||
let error;
|
let error;
|
||||||
const bankFk = 3;
|
const bankFk = 3;
|
||||||
|
|
|
@ -101,7 +101,7 @@ module.exports = Self => {
|
||||||
if (!shipped && landed) {
|
if (!shipped && landed) {
|
||||||
const shippedResult = await models.Agency.getShipped(landed,
|
const shippedResult = await models.Agency.getShipped(landed,
|
||||||
address.id, agencyModeId, warehouseId);
|
address.id, agencyModeId, warehouseId);
|
||||||
shipped = shippedResult && shippedResult.shipped;
|
shipped = (shippedResult && shippedResult.shipped) || landed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shipped && !landed) {
|
if (shipped && !landed) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
let UserError = require('vn-loopback/util/user-error');
|
let UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
describe('ticket new()', () => {
|
fdescribe('ticket new()', () => {
|
||||||
let ticket;
|
let ticket;
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
let ctx = {req: {accessToken: {userId: 1}}};
|
let ctx = {req: {accessToken: {userId: 1}}};
|
||||||
|
@ -28,7 +28,7 @@ describe('ticket new()', () => {
|
||||||
params.shipped,
|
params.shipped,
|
||||||
params.landed,
|
params.landed,
|
||||||
params.warehouseId,
|
params.warehouseId,
|
||||||
params.companyFk,
|
params.companyId,
|
||||||
params.addressId
|
params.addressId
|
||||||
).catch(e => {
|
).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
|
@ -53,7 +53,7 @@ describe('ticket new()', () => {
|
||||||
params.shipped,
|
params.shipped,
|
||||||
params.landed,
|
params.landed,
|
||||||
params.warehouseId,
|
params.warehouseId,
|
||||||
params.companyFk,
|
params.companyId,
|
||||||
params.addressId
|
params.addressId
|
||||||
).catch(response => {
|
).catch(response => {
|
||||||
expect(response.message).toEqual(`This address doesn't exist`);
|
expect(response.message).toEqual(`This address doesn't exist`);
|
||||||
|
@ -79,7 +79,7 @@ describe('ticket new()', () => {
|
||||||
params.shipped,
|
params.shipped,
|
||||||
params.landed,
|
params.landed,
|
||||||
params.warehouseId,
|
params.warehouseId,
|
||||||
params.companyFk,
|
params.companyId,
|
||||||
params.addressId,
|
params.addressId,
|
||||||
params.agencyModeId);
|
params.agencyModeId);
|
||||||
|
|
||||||
|
@ -87,4 +87,27 @@ describe('ticket new()', () => {
|
||||||
|
|
||||||
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
|
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return the set a shipped when the agency is not especified', async() => {
|
||||||
|
let params = {
|
||||||
|
clientId: 104,
|
||||||
|
landed: today,
|
||||||
|
shipped: null,
|
||||||
|
warehouseId: 2,
|
||||||
|
companyId: 442,
|
||||||
|
addressId: 4,
|
||||||
|
agencyModeId: null
|
||||||
|
};
|
||||||
|
|
||||||
|
ticket = await app.models.Ticket.new(ctx,
|
||||||
|
params.clientId,
|
||||||
|
params.shipped,
|
||||||
|
params.landed,
|
||||||
|
params.warehouseId,
|
||||||
|
params.companyId,
|
||||||
|
params.addressId,
|
||||||
|
params.agencyModeId);
|
||||||
|
|
||||||
|
expect(ticket.shipped).toEqual(jasmine.any(Date));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
disabled="!$ctrl.clientId || !$ctrl.landed || !$ctrl.warehouseId"
|
disabled="!$ctrl.clientId || !$ctrl.landed || !$ctrl.warehouseId"
|
||||||
data="$ctrl._availableAgencies"
|
data="$ctrl.agencies"
|
||||||
label="Agency"
|
label="Agency"
|
||||||
show-field="agencyMode"
|
show-field="agencyMode"
|
||||||
value-field="agencyModeFk"
|
value-field="agencyModeFk"
|
||||||
|
|
|
@ -100,9 +100,12 @@ class Controller extends Component {
|
||||||
ticket.agencyModeFk = null;
|
ticket.agencyModeFk = null;
|
||||||
|
|
||||||
this.$http.get(`Agencies/getAgenciesWithWarehouse`, {params}).then(res => {
|
this.$http.get(`Agencies/getAgenciesWithWarehouse`, {params}).then(res => {
|
||||||
this._availableAgencies = res.data;
|
this.agencies = res.data;
|
||||||
|
const defaultAgency = this.agencies.find(agency=> {
|
||||||
this.agencyModeId = this.defaultAddress.agencyModeFk;
|
return agency.agencyModeFk == this.defaultAddress.agencyModeFk;
|
||||||
|
});
|
||||||
|
if (defaultAgency)
|
||||||
|
this.agencyModeId = defaultAgency.agencyModeFk;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue