7565-testToMaster #2567
|
@ -11,11 +11,16 @@ Required applications.
|
|||
* Node.js
|
||||
* Docker
|
||||
* Git
|
||||
* MYT
|
||||
|
||||
You will need to install globally the following items.
|
||||
```
|
||||
$ sudo npm install -g jest gulp-cli
|
||||
```
|
||||
After installing MYT you will need the following item.
|
||||
```
|
||||
$ apt install libkrb5-dev libssl-dev
|
||||
```
|
||||
|
||||
## Installing dependencies and launching
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_ValuateInventory`(vDated DATE, vIsDetailed BOOLEAN)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_valuateInventory`(
|
||||
vDated DATE
|
||||
)
|
||||
BEGIN
|
||||
DECLARE vInventoried DATE;
|
||||
DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE;
|
||||
|
@ -15,8 +17,7 @@ BEGIN
|
|||
SELECT tr.landed INTO vInventoried
|
||||
FROM travel tr
|
||||
JOIN `entry` e ON e.travelFk = tr.id
|
||||
JOIN entryConfig ec
|
||||
WHERE landed <= vDateDayEnd
|
||||
WHERE tr.landed <= vDateDayEnd
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
ORDER BY tr.landed DESC
|
||||
LIMIT 1;
|
||||
|
@ -27,8 +28,7 @@ BEGIN
|
|||
SELECT landed INTO vInventoryClone
|
||||
FROM travel tr
|
||||
JOIN `entry` e ON e.travelFk = tr.id
|
||||
JOIN entryConfig ec
|
||||
WHERE landed >= vDated
|
||||
WHERE tr.landed >= vDated
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
ORDER BY landed ASC
|
||||
LIMIT 1;
|
||||
|
@ -38,13 +38,14 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tInventory(
|
||||
warehouseFk SMALLINT,
|
||||
itemFk BIGINT,
|
||||
quantity INT,
|
||||
cost DOUBLE DEFAULT 0,
|
||||
total DOUBLE DEFAULT 0,
|
||||
warehouseInventory VARCHAR(20),
|
||||
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
|
||||
warehouseFk SMALLINT,
|
||||
itemFk BIGINT,
|
||||
quantity INT,
|
||||
volume DECIMAL(10,2),
|
||||
cost DOUBLE DEFAULT 0,
|
||||
total DOUBLE DEFAULT 0,
|
||||
warehouseInventory VARCHAR(20),
|
||||
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
|
||||
)
|
||||
ENGINE = MEMORY;
|
||||
|
||||
|
@ -60,9 +61,8 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN warehouse w ON w.id = warehouseInFk
|
||||
JOIN entryConfig ec
|
||||
WHERE landed = vDateDayEnd
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
WHERE tr.landed = vDateDayEnd
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
|
@ -78,9 +78,8 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN warehouse w ON w.id = warehouseInFk
|
||||
JOIN entryConfig ec
|
||||
WHERE landed = vInventoried
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
WHERE tr.landed = vInventoried
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
|
@ -99,7 +98,6 @@ BEGIN
|
|||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
JOIN entryConfig ec
|
||||
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
||||
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
||||
AND NOT e.isRaid
|
||||
|
@ -183,52 +181,37 @@ BEGIN
|
|||
AND e.isConfirmed
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
|
||||
|
||||
CALL vn.buyUltimate(NULL, vDateDayEnd);
|
||||
CALL buyUltimate(NULL, vDateDayEnd);
|
||||
|
||||
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
|
||||
|
||||
UPDATE tInventory i
|
||||
JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.itemFk = bu.itemFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
SET total = i.quantity * (IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)),
|
||||
cost = IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)
|
||||
WHERE i.quantity;
|
||||
LEFT JOIN itemCost ic ON ic.itemFk = i.itemFk
|
||||
AND ic.warehouseFk = i.warehouseFk
|
||||
SET i.total = i.quantity * (IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)),
|
||||
i.cost = IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0),
|
||||
i.volume = i.quantity * ic.cm3delivery / 1000000;
|
||||
|
||||
DELETE FROM tInventory
|
||||
WHERE quantity IS NULL OR NOT quantity;
|
||||
|
||||
IF vIsDetailed THEN
|
||||
SELECT ti.warehouseFk,
|
||||
i.id itemFk,
|
||||
i.longName,
|
||||
i.size,
|
||||
ti.quantity,
|
||||
tp.name Tipo,
|
||||
ic.name Reino,
|
||||
ti.cost,
|
||||
CAST(ti.total AS DECIMAL(10, 2)) total,
|
||||
ti.warehouseInventory almacen
|
||||
FROM tInventory ti
|
||||
JOIN warehouse w ON w.id = warehouseFk
|
||||
JOIN item i ON i.id = ti.itemFk
|
||||
JOIN itemType tp ON tp.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||
WHERE w.valuatedInventory
|
||||
AND ti.total > 0
|
||||
ORDER BY ti.total DESC;
|
||||
ELSE
|
||||
SELECT i.warehouseInventory Almacen,
|
||||
ic.name Reino,
|
||||
CAST(i.total AS DECIMAL(10, 2)) Euros,
|
||||
w.code Comprador,
|
||||
it.id
|
||||
FROM tInventory i
|
||||
JOIN warehouse wh ON wh.id = warehouseFk
|
||||
JOIN item it ON it.id = i.itemFk
|
||||
JOIN itemType itp ON itp.id = it.typeFk
|
||||
LEFT JOIN worker w ON w.id = itp.workerFk
|
||||
JOIN itemCategory ic ON ic.id = itp.categoryFk
|
||||
WHERE wh.valuatedInventory
|
||||
AND i.total > 0;
|
||||
END IF;
|
||||
SELECT ti.warehouseFk,
|
||||
i.id,
|
||||
i.longName,
|
||||
i.size,
|
||||
ti.quantity,
|
||||
ti.volume,
|
||||
tp.name itemTypeName,
|
||||
ic.name itemCategoryName,
|
||||
ti.cost,
|
||||
ti.total,
|
||||
ti.warehouseInventory
|
||||
FROM tInventory ti
|
||||
JOIN warehouse w ON w.id = warehouseFk
|
||||
JOIN item i ON i.id = ti.itemFk
|
||||
JOIN itemType tp ON tp.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||
WHERE w.valuatedInventory
|
||||
AND ti.total > 0;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.buyUltimate,
|
|
@ -51,7 +51,7 @@ describe('Client Add address path', () => {
|
|||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Incoterms is required for a non UEE member');
|
||||
expect(message.text).toContain('Incoterms and Customs agent are required for a non UEE member');
|
||||
});
|
||||
|
||||
it(`should receive an error after clicking save button as customsAgent is empty`, async() => {
|
||||
|
|
|
@ -227,5 +227,7 @@
|
|||
"They're not your subordinate": "They're not your subordinate",
|
||||
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
||||
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
|
||||
"You can only have one PDA": "You can only have one PDA"
|
||||
}
|
||||
"You can only have one PDA": "You can only have one PDA",
|
||||
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,5 +359,6 @@
|
|||
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
|
||||
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
||||
"You can only have one PDA": "Solo puedes tener un PDA"
|
||||
}
|
||||
"You can only have one PDA": "Solo puedes tener un PDA",
|
||||
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE"
|
||||
}
|
||||
|
|
|
@ -92,11 +92,8 @@ module.exports = function(Self) {
|
|||
}, myOptions);
|
||||
|
||||
const isUeeMember = province.country().isUeeMember;
|
||||
if (!isUeeMember && !args.incotermsFk)
|
||||
throw new UserError(`Incoterms is required for a non UEE member`);
|
||||
|
||||
if (!isUeeMember && !args.customsAgentFk)
|
||||
throw new UserError(`Customs agent is required for a non UEE member`);
|
||||
if (!isUeeMember && (!args.incotermsFk || !args.customsAgentFk))
|
||||
throw new UserError(`Incoterms and Customs agent are required for a non UEE member`);
|
||||
|
||||
delete args.ctx; // Remove unwanted properties
|
||||
const newAddress = await models.Address.create(args, myOptions);
|
||||
|
|
|
@ -50,7 +50,7 @@ describe('Address createAddress', () => {
|
|||
}
|
||||
|
||||
expect(error).toBeDefined();
|
||||
expect(error.message).toEqual('Incoterms is required for a non UEE member');
|
||||
expect(error.message).toEqual('Incoterms and Customs agent are required for a non UEE member');
|
||||
});
|
||||
|
||||
it('should throw a non uee member error if no customsAgent is defined', async() => {
|
||||
|
@ -81,7 +81,7 @@ describe('Address createAddress', () => {
|
|||
}
|
||||
|
||||
expect(error).toBeDefined();
|
||||
expect(error.message).toEqual('Customs agent is required for a non UEE member');
|
||||
expect(error.message).toEqual('Incoterms and Customs agent are required for a non UEE member');
|
||||
});
|
||||
|
||||
it('should create a new address and set as a client default address', async() => {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<vn-autocomplete
|
||||
url="Tickets"
|
||||
label="Ticket"
|
||||
search-function="{or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}"
|
||||
search-function="{refFk: null, or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}"
|
||||
show-field="id"
|
||||
value-field="id"
|
||||
fields="['nickname']"
|
||||
|
|
Loading…
Reference in New Issue