Merge pull request '2433 - Added sage fields + e2e' (#414) from 2433-sage_fiscalData into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #414
Reviewed-by: Carlos Jimenez <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2020-10-21 09:12:49 +00:00
commit a603e5da83
12 changed files with 188 additions and 4 deletions

View File

@ -83,6 +83,9 @@ export default {
equalizationTaxCheckbox: 'vn-client-fiscal-data vn-check[ng-model="$ctrl.client.isEqualizated"]',
address: 'vn-client-fiscal-data vn-textfield[ng-model="$ctrl.client.street"]',
postcode: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.postcode"]',
sageTax: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTaxTypeFk"]',
sageTransaction: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.sageTransactionTypeFk"]',
transferor: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.transferorFk"]',
city: 'vn-client-fiscal-data vn-datalist[ng-model="$ctrl.client.city"]',
province: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
country: 'vn-client-fiscal-data vn-autocomplete[ng-model="$ctrl.client.countryFk"]',

View File

@ -66,6 +66,9 @@ describe('Client Edit fiscalData path', () => {
await page.autocompleteSearch(selectors.clientFiscalData.province, 'Province one');
await page.clearInput(selectors.clientFiscalData.city);
await page.write(selectors.clientFiscalData.city, 'Valencia');
await page.autocompleteSearch(selectors.clientFiscalData.sageTax, 'operaciones no sujetas');
await page.autocompleteSearch(selectors.clientFiscalData.sageTransaction, 'regularización de inversiones');
await page.autocompleteSearch(selectors.clientFiscalData.transferor, 'Max Eisenhardt');
await page.clearInput(selectors.clientFiscalData.postcode);
await page.write(selectors.clientFiscalData.postcode, '46000');
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
@ -188,6 +191,24 @@ describe('Client Edit fiscalData path', () => {
expect(result).toContain('46000');
});
it('should confirm the sageTax have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTax, 'value');
expect(result).toEqual('Operaciones no sujetas');
});
it('should confirm the sageTransaction have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.sageTransaction, 'value');
expect(result).toEqual('Regularización de inversiones');
});
it('should confirm the transferor have been edited', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.transferor, 'value');
expect(result).toEqual('Max Eisenhardt');
});
it('should confirm the city have been autocompleted', async() => {
const result = await page.waitToGetProperty(selectors.clientFiscalData.city, 'value');

View File

@ -29,7 +29,6 @@ describe('Client updateFiscalData', () => {
const ctx = {req: {accessToken: {userId: 5}}};
ctx.args = {postcode: 46680};
const client = await app.models.Client.findById(clientId);
expect(client.postcode).toEqual('46460');

View File

@ -43,6 +43,18 @@ module.exports = Self => {
arg: 'provinceFk',
type: 'number'
},
{
arg: 'sageTaxTypeFk',
type: 'number'
},
{
arg: 'sageTransactionTypeFk',
type: 'number'
},
{
arg: 'transferorFk',
type: 'number'
},
{
arg: 'hasToInvoiceByAddress',
type: 'boolean'

View File

@ -83,6 +83,12 @@
"SmsConfig": {
"dataSource": "vn"
},
"SageTaxType": {
"dataSource": "vn"
},
"SageTransactionType": {
"dataSource": "vn"
},
"TpvError": {
"dataSource": "vn"
},

View File

@ -118,6 +118,18 @@
},
"created": {
"type": "Date"
},
"sageTaxTypeFk": {
"type": "number",
"mysql": {
"columnName": "taxTypeSageFk"
}
},
"sageTransactionTypeFk": {
"type": "number",
"mysql": {
"columnName": "transactionTypeSageFk"
}
}
},
"relations": {
@ -200,6 +212,20 @@
"type": "hasOne",
"model": "ClaimRatio",
"foreignKey": "clientFk"
},
"transferor": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "transferorFk"
}
}
},
"scopes": {
"isActive": {
"where": {
"isActive": {
"neq": false
}
}
}
}
}

View File

@ -0,0 +1,33 @@
{
"name": "SageTaxType",
"base": "VnModel",
"options": {
"mysql": {
"table": "sage.TiposIva"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier",
"mysql": {
"columnName": "CodigoIva"
}
},
"vat": {
"type": "string",
"mysql": {
"columnName": "Iva"
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -0,0 +1,33 @@
{
"name": "SageTransactionType",
"base": "VnModel",
"options": {
"mysql": {
"table": "sage.TiposTransacciones"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier",
"mysql": {
"columnName": "CodigoTransaccion"
}
},
"transaction": {
"type": "string",
"mysql": {
"columnName": "Transaccion"
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -18,6 +18,18 @@
data="countries"
order="country">
</vn-crud-model>
<vn-crud-model
auto-load="true"
url="SageTaxTypes"
data="sageTaxTypes"
order="vat">
</vn-crud-model>
<vn-crud-model
auto-load="true"
url="SageTransactionTypes"
data="sageTransactionTypes"
order="transaction">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
@ -44,6 +56,35 @@
rule>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
ng-model="$ctrl.client.sageTaxTypeFk"
data="sageTaxTypes"
show-field="vat"
value-field="id"
label="Sage tax type"
rule>
</vn-autocomplete>
<vn-autocomplete vn-one
ng-model="$ctrl.client.sageTransactionTypeFk"
data="sageTransactionTypes"
show-field="transaction"
value-field="id"
label="Sage transaction type"
rule>
</vn-autocomplete>
<vn-autocomplete vn-one
ng-model="$ctrl.client.transferorFk"
url="Clients/isActive"
search-function="$ctrl.transferorSearchFunction($search)"
where="{id: {neq: $ctrl.client.id}}"
show-field="name"
value-field="id"
label="Previous client"
info="In case of a company succession, specify the grantor company"
rule>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-datalist vn-one
label="Postcode"

View File

@ -163,6 +163,12 @@ export default class Controller extends Section {
this.client.provinceFk = response.provinceFk;
this.client.countryFk = response.countryFk;
}
transferorSearchFunction($search) {
return /^\d+$/.test($search)
? {id: $search}
: {name: {like: '%' + $search + '%'}};
}
}
ngModule.vnComponent('vnClientFiscalData', {

View File

@ -6,3 +6,7 @@ In order to invoice, this field is not consulted, but the consignee's ET. When m
You can use letters and spaces: Se pueden utilizar letras y espacios
Found a client with this data: Se ha encontrado un cliente con estos datos
Found a client with this phone or email: El cliente con id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> ya tiene este teléfono o email. <br/> ¿Quieres continuar?
Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage
Previous client: Cliente anterior
In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente

View File

@ -53,7 +53,7 @@
"babel-preset-es2015": "^6.24.1",
"css-loader": "^2.1.0",
"del": "^2.2.2",
"eslint": "^5.14.0",
"eslint": "^7.11.0",
"eslint-config-google": "^0.11.0",
"eslint-plugin-jasmine": "^2.10.1",
"fancy-log": "^1.3.2",