7525-devToTest #2542

Merged
alexm merged 231 commits from 7525-devToTest into test 2024-06-04 07:59:34 +00:00
4 changed files with 10 additions and 8 deletions
Showing only changes of commit 9bd5244f64 - Show all commits

View File

@ -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() => {

View File

@ -226,5 +226,6 @@
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
"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"
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
}

View File

@ -92,11 +92,12 @@ 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)
if (!isUeeMember && (!args.incotermsFk || !args.customsAgentFk)) {
if (!args.incotermsFk)
throw new UserError(`Incoterms and Customs agent are required for a non UEE member`);
else
throw new UserError(`Customs agent is required for a non UEE member`);
}
delete args.ctx; // Remove unwanted properties
const newAddress = await models.Address.create(args, myOptions);

View File

@ -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() => {