Merge pull request '3893-supplier.fiscal-data' (#947) from 3893-supplier.fiscal-data into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #947
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2022-05-16 06:05:30 +00:00
commit a71e53fdf4
12 changed files with 95 additions and 6 deletions

View File

@ -0,0 +1,5 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('SupplierActivity', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('SupplierActivity', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');

View File

@ -1313,11 +1313,11 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr
(5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'), (5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
(6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'); (6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`) INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
VALUES VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1), (1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1), (2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants', 1); (442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
VALUES VALUES

View File

@ -41,7 +41,9 @@ module.exports = Self => {
'sageTaxTypeFk', 'sageTaxTypeFk',
'sageTransactionTypeFk', 'sageTransactionTypeFk',
'sageWithholdingFk', 'sageWithholdingFk',
'workerFk' 'workerFk',
'supplierActivityFk',
'healthRegister'
], ],
include: [ include: [
{ {
@ -98,6 +100,12 @@ module.exports = Self => {
} }
} }
}, },
{
relation: 'supplierActivity',
scope: {
fields: ['code', 'name']
}
}
] ]
}; };

View File

@ -66,6 +66,8 @@ describe('Supplier updateFiscalData', () => {
city: 'VALENCIA', city: 'VALENCIA',
provinceFk: 2, provinceFk: 2,
countryFk: 1, countryFk: 1,
supplierActivityFk: 'animals',
healthRegister: '400664487H'
}; };
const result = await app.models.Supplier.updateFiscalData(ctx, supplierId); const result = await app.models.Supplier.updateFiscalData(ctx, supplierId);
@ -80,6 +82,8 @@ describe('Supplier updateFiscalData', () => {
expect(result.city).toEqual('VALENCIA'); expect(result.city).toEqual('VALENCIA');
expect(result.provinceFk).toEqual(2); expect(result.provinceFk).toEqual(2);
expect(result.countryFk).toEqual(1); expect(result.countryFk).toEqual(1);
expect(result.supplierActivityFk).toEqual('animals');
expect(result.healthRegister).toEqual('400664487H');
// Restores // Restores
ctx.args = defaultData; ctx.args = defaultData;

View File

@ -56,6 +56,14 @@ module.exports = Self => {
{ {
arg: 'countryFk', arg: 'countryFk',
type: 'any' type: 'any'
},
{
arg: 'supplierActivityFk',
type: 'string'
},
{
arg: 'healthRegister',
type: 'string'
}], }],
returns: { returns: {
arg: 'res', arg: 'res',

View File

@ -11,6 +11,9 @@
"SupplierAccount": { "SupplierAccount": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SupplierActivity": {
"dataSource": "vn"
},
"SupplierAgencyTerm": { "SupplierAgencyTerm": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,18 @@
{
"name": "SupplierActivity",
"base": "VnModel",
"options": {
"mysql": {
"table": "supplierActivity"
}
},
"properties": {
"code": {
"type": "string",
"id": true
},
"name": {
"type": "string"
}
}
}

View File

@ -101,6 +101,12 @@
}, },
"isPayMethodChecked": { "isPayMethodChecked": {
"type": "boolean" "type": "boolean"
},
"supplierActivityFk": {
"type": "string"
},
"healthRegister": {
"type": "string"
} }
}, },
"relations": { "relations": {
@ -159,6 +165,11 @@
"type": "hasMany", "type": "hasMany",
"model": "SupplierAddress", "model": "SupplierAddress",
"foreignKey": "supplierFk" "foreignKey": "supplierFk"
},
"supplierActivity": {
"type": "belongsTo",
"model": "SupplierActivity",
"foreignKey": "supplierActivityFk"
} }
} }
} }

View File

@ -30,6 +30,11 @@
data="sageWithholdings" data="sageWithholdings"
order="withholding"> order="withholding">
</vn-crud-model> </vn-crud-model>
<vn-crud-model
auto-load="true"
url="SupplierActivities"
data="supplierActivities">
</vn-crud-model>
<form name="form" vn-http-submit="watcher.submit()" class="vn-w-md"> <form name="form" vn-http-submit="watcher.submit()" class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal> <vn-horizontal>
@ -87,6 +92,22 @@
<tpl-item>{{id}}: {{transaction}}</tpl-item> <tpl-item>{{id}}: {{transaction}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
ng-model="$ctrl.supplier.supplierActivityFk"
data="supplierActivities"
show-field="name"
value-field="code"
label="Supplier activity"
rule>
</vn-autocomplete>
<vn-textfield
vn-one
label="Healt register"
ng-model="$ctrl.supplier.healthRegister"
rule>
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one

View File

@ -1,3 +1,5 @@
Sage tax type: Tipo de impuesto Sage Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage Sage transaction type: Tipo de transacción Sage
Sage withholding: Retención Sage Sage withholding: Retención Sage
Supplier activity: Actividad proveedor
Healt register: Pasaporte sanitario

View File

@ -113,6 +113,13 @@
label="Sage withholding" label="Sage withholding"
value="{{::$ctrl.summary.sageWithholding.withholding}}"> value="{{::$ctrl.summary.sageWithholding.withholding}}">
</vn-label-value> </vn-label-value>
<vn-label-value
label="Supplier activity"
value="{{::$ctrl.summary.supplierActivity.name}}">
</vn-label-value>
<vn-label-value
label="Healt register"
value="{{::$ctrl.summary.healthRegister}}">
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -7,4 +7,6 @@ Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage Sage transaction type: Tipo de transacción Sage
Sage withholding: Retencion Sage Sage withholding: Retencion Sage
Go to the supplier: Ir al proveedor Go to the supplier: Ir al proveedor
Responsible: Responsable Responsible: Responsable
Supplier activity: Actividad proveedor
Healt register: Pasaporte sanitario