2433 - Added sage fields
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-10-15 11:53:01 +02:00
parent 2e3402b0cd
commit ca7601a9f2
9 changed files with 163 additions and 3 deletions

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

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

View File

@ -5,4 +5,8 @@ Frozen: Congelado
In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar.
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?
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