fixes #4457 hasInvoiceElectronic-para-cliente #1116

Merged
pau merged 18 commits from 4457-hasInvoiceElectronic-para-cliente into dev 2022-11-24 09:45:45 +00:00
15 changed files with 19767 additions and 188 deletions

View File

@ -0,0 +1,2 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
pau marked this conversation as resolved Outdated
Outdated
Review

Template strings

Template strings
VALUES ('NotificationQueue','*','*','ALLOW','ROLE','employee');

View File

@ -0,0 +1,8 @@
ALTER TABLE
`vn`.`client`
ADD
COLUMN `hasElectronicInvoice` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Registro de facturas mediante FACe'
AFTER
`hasInvoiceSimplified`;
-- sería más correcto hasElectronicInvoice pero ya existe un campo hasInvoiceSimplified

View File

@ -0,0 +1 @@
insert into `util`.`notification` (`id`, `name`,`description`) values (2, 'invoiceElectronic', 'A electronic invoice has been generated');

View File

@ -0,0 +1,3 @@
UPDATE `vn`.`client`
set hasElectronicInvoice = TRUE
where buisnessTypeFk = 'officialOrganism'

View File

@ -0,0 +1,6 @@
UPDATE
`vn`.`client`
SET
hasElectronicInvoice = TRUE
WHERE
businessTypeFk = 'officialOrganism';

View File

@ -1,7 +1,7 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 1,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
@ -189,10 +189,14 @@
"integrity": "sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw==" "integrity": "sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw=="
}, },
"angular-animate": { "angular-animate": {
"version": "1.8.2" "version": "1.8.2",
"resolved": "https://registry.npmjs.org/angular-animate/-/angular-animate-1.8.2.tgz",
"integrity": "sha512-Jbr9+grNMs9Kj57xuBU3Ju3NOPAjS1+g2UAwwDv7su1lt0/PLDy+9zEwDiu8C8xJceoTbmBNKiWGPJGBdCQLlA=="
}, },
"angular-moment": { "angular-moment": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.3.0.tgz",
"integrity": "sha512-KG8rvO9MoaBLwtGnxTeUveSyNtrL+RNgGl1zqWN36+HDCCVGk2DGWOzqKWB6o+eTTbO3Opn4hupWKIElc8XETA==",
"requires": { "requires": {
"moment": ">=2.8.0 <3.0.0" "moment": ">=2.8.0 <3.0.0"
} }
@ -215,18 +219,26 @@
}, },
"argparse": { "argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"requires": { "requires": {
"sprintf-js": "~1.0.2" "sprintf-js": "~1.0.2"
} }
}, },
"croppie": { "croppie": {
"version": "2.6.5" "version": "2.6.5",
"resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
"integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
}, },
"esprima": { "esprima": {
"version": "4.0.1" "version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
}, },
"js-yaml": { "js-yaml": {
"version": "3.14.1", "version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"requires": { "requires": {
"argparse": "^1.0.7", "argparse": "^1.0.7",
"esprima": "^4.0.0" "esprima": "^4.0.0"
@ -234,6 +246,8 @@
}, },
"mg-crud": { "mg-crud": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz",
"integrity": "sha512-mAR6t0aQHKnT0QHKHpLOi0kNPZfO36iMpIoiLjFHxuio6mIJyuveBJ4VNlNXJRxLh32/FLADEb41/sYo7QUKFw==",
"requires": { "requires": {
"angular": "^1.6.1" "angular": "^1.6.1"
} }
@ -244,19 +258,27 @@
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
}, },
"oclazyload": { "oclazyload": {
"version": "0.6.3" "version": "0.6.3",
"resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz",
"integrity": "sha512-HpOSYUgjtt6sTB/C6+FWsExR+9HCnXKsUA96RWkDXfv11C8Cc9X2DlR0WIZwFIiG6FQU0pwB5dhoYyut8bFAOQ=="
}, },
"require-yaml": { "require-yaml": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz",
"integrity": "sha512-M6eVEgLPRbeOhgSCnOTtdrOOEQzbXRchg24Xa13c39dMuraFKdI9emUo97Rih0YEFzSICmSKg8w4RQp+rd9pOQ==",
"requires": { "requires": {
"js-yaml": "" "js-yaml": "^4.1.0"
}, },
"dependencies": { "dependencies": {
"argparse": { "argparse": {
"version": "2.0.1" "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
}, },
"js-yaml": { "js-yaml": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"requires": { "requires": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
} }
@ -264,10 +286,14 @@
} }
}, },
"sprintf-js": { "sprintf-js": {
"version": "1.0.3" "version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="
}, },
"validator": { "validator": {
"version": "6.3.0" "version": "6.3.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-6.3.0.tgz",
"integrity": "sha512-BylxTwhqwjQI5MDJF7amCy/L0ejJO+74DvCsLV52Lq3+3bhVcVMKqNqOiNcQJm2G48u9EAcw4xFERAmFbwXM9Q=="
} }
} }
} }

View File

@ -99,6 +99,10 @@ module.exports = Self => {
{ {
arg: 'hasIncoterms', arg: 'hasIncoterms',
type: 'boolean' type: 'boolean'
},
{
arg: 'hasElectronicInvoice',
type: 'boolean'
} }
], ],
returns: { returns: {
@ -122,19 +126,15 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (!myOptions.transaction) { if (!myOptions.transaction) {
tx = await Self.beginTransaction({}); tx = await Self.beginTransaction({});
myOptions.transaction = tx; myOptions.transaction = tx;
} }
try { try {
const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions); const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions);
const client = await models.Client.findById(clientId, null, myOptions); const client = await models.Client.findById(clientId, null, myOptions);
if (!isSalesAssistant && client.isTaxDataChecked) if (!isSalesAssistant && client.isTaxDataChecked)
throw new UserError(`Not enough privileges to edit a client with verified data`); throw new UserError(`Not enough privileges to edit a client with verified data`);
// Sage data validation // Sage data validation
const taxDataChecked = args.isTaxDataChecked; const taxDataChecked = args.isTaxDataChecked;
const sageTaxChecked = client.sageTaxTypeFk || args.sageTaxTypeFk; const sageTaxChecked = client.sageTaxTypeFk || args.sageTaxTypeFk;
@ -143,7 +143,6 @@ module.exports = Self => {
if (taxDataChecked && !hasSageData) if (taxDataChecked && !hasSageData)
throw new UserError(`You need to fill sage information before you check verified data`); throw new UserError(`You need to fill sage information before you check verified data`);
if (args.despiteOfClient) { if (args.despiteOfClient) {
const logRecord = { const logRecord = {
originFk: clientId, originFk: clientId,
@ -158,7 +157,6 @@ module.exports = Self => {
await models.ClientLog.create(logRecord, myOptions); await models.ClientLog.create(logRecord, myOptions);
} }
// Remove unwanted properties // Remove unwanted properties
delete args.ctx; delete args.ctx;
delete args.id; delete args.id;

View File

@ -142,7 +142,11 @@
}, },
"salesPersonFk": { "salesPersonFk": {
"type": "number" "type": "number"
},
"hasElectronicInvoice": {
"type": "boolean"
} }
}, },
"relations": { "relations": {
"account": { "account": {

View File

@ -1,112 +1,52 @@
<mg-ajax path="Clients/{{patch.params.id}}/updateFiscalData" options="vnPatch"></mg-ajax> <mg-ajax path="Clients/{{patch.params.id}}/updateFiscalData" options="vnPatch"></mg-ajax>
<vn-watcher <vn-watcher vn-id="watcher" data="$ctrl.client" id-field="id" form="form" save="patch">
vn-id="watcher"
data="$ctrl.client"
id-field="id"
form="form"
save="patch">
</vn-watcher> </vn-watcher>
<vn-crud-model <vn-crud-model auto-load="true" url="Provinces/location" data="provincesLocation" order="name">
auto-load="true"
url="Provinces/location"
data="provincesLocation"
order="name">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model auto-load="true" url="Countries" data="countries" order="country">
auto-load="true"
url="Countries"
data="countries"
order="country">
</vn-crud-model> </vn-crud-model>
<vn-crud-model <vn-crud-model auto-load="true" url="SageTaxTypes" data="sageTaxTypes" order="vat">
auto-load="true"
url="SageTaxTypes"
data="sageTaxTypes"
order="vat">
</vn-crud-model> </vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md"> <form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield vn-two vn-focus label="Social name" ng-model="$ctrl.client.socialName" rule
vn-two info="Only letters, numbers and spaces can be used" required="true">
vn-focus
label="Social name"
ng-model="$ctrl.client.socialName"
rule
info="Only letters, numbers and spaces can be used"
required="true">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield vn-one label="Tax number" ng-model="$ctrl.client.fi" rule>
vn-one
label="Tax number"
ng-model="$ctrl.client.fi"
rule>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield vn-two label="Street" ng-model="$ctrl.client.street" rule>
vn-two
label="Street"
ng-model="$ctrl.client.street"
rule>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one ng-model="$ctrl.client.sageTaxTypeFk" data="sageTaxTypes" show-field="vat"
ng-model="$ctrl.client.sageTaxTypeFk" value-field="id" label="Sage tax type" vn-acl="salesAssistant" rule>
data="sageTaxTypes"
show-field="vat"
value-field="id"
label="Sage tax type"
vn-acl="salesAssistant"
rule>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one ng-model="$ctrl.client.sageTransactionTypeFk" url="SageTransactionTypes"
ng-model="$ctrl.client.sageTransactionTypeFk" show-field="transaction" value-field="id" label="Sage transaction type"
url="SageTransactionTypes"
show-field="transaction"
value-field="id"
label="Sage transaction type"
search-function="{or: [{id: $search}, {transaction: {like: '%'+ $search +'%'}}]}" search-function="{or: [{id: $search}, {transaction: {like: '%'+ $search +'%'}}]}"
vn-acl="salesAssistant" vn-acl="salesAssistant" order="transaction" rule>
order="transaction"
rule>
<tpl-item>{{id}}: {{transaction}}</tpl-item> <tpl-item>{{id}}: {{transaction}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-datalist vn-one <vn-datalist vn-one label="Postcode" ng-model="$ctrl.client.postcode" selection="$ctrl.postcode"
label="Postcode" url="Postcodes/location" fields="['code','townFk']" order="code, townFk" value-field="code"
ng-model="$ctrl.client.postcode" show-field="code" rule>
selection="$ctrl.postcode"
url="Postcodes/location"
fields="['code','townFk']"
order="code, townFk"
value-field="code"
show-field="code"
rule>
<tpl-item> <tpl-item>
{{code}} - {{town.name}} ({{town.province.name}}, {{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}}) {{town.province.country.country}})
</tpl-item> </tpl-item>
<append> <append>
<vn-icon-button <vn-icon-button icon="add_circle" vn-tooltip="New postcode" ng-click="postcode.open()"
icon="add_circle" vn-acl="deliveryBoss" vn-acl-action="remove">
vn-tooltip="New postcode"
ng-click="postcode.open()"
vn-acl="deliveryBoss"
vn-acl-action="remove">
</vn-icon-button> </vn-icon-button>
</append> </append>
</vn-datalist> </vn-datalist>
<vn-datalist vn-id="town" vn-one <vn-datalist vn-id="town" vn-one label="City" ng-model="$ctrl.client.city" selection="$ctrl.town"
label="City" url="Towns/location" fields="['id', 'name', 'provinceFk']" show-field="name" value-field="name">
ng-model="$ctrl.client.city"
selection="$ctrl.town"
url="Towns/location"
fields="['id', 'name', 'provinceFk']"
show-field="name"
value-field="name">
<tpl-item> <tpl-item>
{{name}}, {{province.name}} {{name}}, {{province.name}}
({{province.country.country}}) ({{province.country.country}})
@ -114,112 +54,64 @@
</vn-datalist> </vn-datalist>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-id="province" vn-one <vn-autocomplete vn-id="province" vn-one label="Province" ng-model="$ctrl.client.provinceFk"
label="Province" selection="$ctrl.province" data="provincesLocation" fields="['id', 'name', 'countryFk']"
ng-model="$ctrl.client.provinceFk" show-field="name" value-field="id" rule>
selection="$ctrl.province"
data="provincesLocation"
fields="['id', 'name', 'countryFk']"
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item> <tpl-item>{{name}} ({{country.country}})</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-id="country" vn-one <vn-autocomplete vn-id="country" vn-one ng-model="$ctrl.client.countryFk" data="countries"
ng-model="$ctrl.client.countryFk" show-field="country" value-field="id" label="Country" rule>
data="countries"
show-field="country"
value-field="id"
label="Country"
rule>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check vn-one label="Active" ng-model="$ctrl.client.isActive">
vn-one
label="Active"
ng-model="$ctrl.client.isActive">
</vn-check> </vn-check>
<vn-check <vn-check vn-one label="Frozen" ng-model="$ctrl.client.isFreezed">
vn-one
label="Frozen"
ng-model="$ctrl.client.isFreezed">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check vn-one label="Has to invoice" ng-model="$ctrl.client.hasToInvoice">
vn-one
label="Has to invoice"
ng-model="$ctrl.client.hasToInvoice">
</vn-check> </vn-check>
<vn-check <vn-check vn-one label="Vies" ng-model="$ctrl.client.isVies">
vn-one
label="Vies"
ng-model="$ctrl.client.isVies">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check vn-one label="Notify by email" ng-model="$ctrl.client.isToBeMailed">
vn-one
label="Notify by email"
ng-model="$ctrl.client.isToBeMailed">
</vn-check> </vn-check>
<vn-check <vn-check vn-one label="Invoice by address" ng-model="$ctrl.client.hasToInvoiceByAddress">
vn-one
label="Invoice by address"
ng-model="$ctrl.client.hasToInvoiceByAddress">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check vn-one label="Is equalizated" ng-model="$ctrl.client.isEqualizated"
vn-one
label="Is equalizated"
ng-model="$ctrl.client.isEqualizated"
info="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." info="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."
on-change="$ctrl.onChangeEqualizated(value)"> on-change="$ctrl.onChangeEqualizated(value)">
</vn-check> </vn-check>
<vn-check <vn-check vn-one label="Verified data" ng-model="$ctrl.client.isTaxDataChecked" vn-acl="salesAssistant">
vn-one
label="Verified data"
ng-model="$ctrl.client.isTaxDataChecked"
vn-acl="salesAssistant">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check vn-one label="Incoterms authorization" ng-model="$ctrl.client.hasIncoterms"
vn-one vn-acl="administrative">
label="Incoterms authorization" </vn-check>
ng-model="$ctrl.client.hasIncoterms" <vn-check vn-one label="Electronic invoice" ng-model="$ctrl.client.hasElectronicInvoice"
vn-acl="administrative"> vn-acl="administrative">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit <vn-submit disabled="!watcher.dataChanged()" label="Save">
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit> </vn-submit>
<vn-button <vn-button class="cancel" label="Undo changes" disabled="!watcher.dataChanged()"
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()"> ng-click="watcher.loadOriginalData()">
</vn-button> </vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>
<vn-confirm <vn-confirm vn-id="propagate-isEqualizated" question="You changed the equalization tax"
vn-id="propagate-isEqualizated" message="Do you want to spread the change?" on-accept="$ctrl.onAcceptEt()">
question="You changed the equalization tax"
message="Do you want to spread the change?"
on-accept="$ctrl.onAcceptEt()">
</vn-confirm> </vn-confirm>
<vn-confirm <vn-confirm vn-id="confirm-duplicatedClient" message="Found a client with this data"
vn-id="confirm-duplicatedClient"
message="Found a client with this data"
on-accept="$ctrl.onAcceptDuplication()"> on-accept="$ctrl.onAcceptDuplication()">
</vn-confirm> </vn-confirm>
<!-- New postcode dialog --> <!-- New postcode dialog -->
<vn-geo-postcode <vn-geo-postcode vn-id="postcode" on-response="$ctrl.onResponse($response)">
vn-id="postcode"
on-response="$ctrl.onResponse($response)">
</vn-geo-postcode> </vn-geo-postcode>

View File

@ -10,4 +10,5 @@ Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage Sage transaction type: Tipo de transacción Sage
Previous client: Cliente anterior 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 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
Incoterms authorization: Autorización incoterms Incoterms authorization: Autorización incoterms
Electronic invoice: Factura electrónica

View File

@ -35,7 +35,8 @@ class Controller extends ModuleCard {
'credit', 'credit',
'email', 'email',
'phone', 'phone',
'mobile' 'mobile',
'hasElectronicInvoice',
], ],
include: { include: {
relation: 'salesPersonUser', relation: 'salesPersonUser',

View File

@ -65,7 +65,8 @@ class Controller extends Section {
'credit', 'credit',
'email', 'email',
'phone', 'phone',
'mobile' 'mobile',
'hasElectronicInvoice',
], ],
include: { include: {
relation: 'salesPersonUser', relation: 'salesPersonUser',
@ -243,6 +244,23 @@ class Controller extends Section {
makeInvoice() { makeInvoice() {
const params = {ticketsIds: [this.id]}; const params = {ticketsIds: [this.id]};
/*
This should call the notification sistem to insert a new notification
in te queue, yet to check how to handle user permissions,
as of 08-11-2022 every employee can insert a new notification in the queue
*/
const client = this.ticket.client;
if (client.hasElectronicInvoice) {
this.$http.post(`NotificationQueues`, {
notificationFk: 'invoiceElectronic',
authorFk: client.id,
}).then(a => {
this.vnApp.showSuccess(this.$t('Invoice sent'));
});
}
return this.$http.post(`Tickets/makeInvoice`, params) return this.$http.post(`Tickets/makeInvoice`, params)
.then(() => this.reload()) .then(() => this.reload())
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));

View File

@ -9,5 +9,6 @@ Send CSV Delivery Note: Enviar albarán en CSV
Send PDF Delivery Note: Enviar albarán en PDF Send PDF Delivery Note: Enviar albarán en PDF
Show Proforma: Ver proforma Show Proforma: Ver proforma
Refund all: Abonar todo Refund all: Abonar todo
Invoice sent: Factura enviada
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}" The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
Transfer client: Transferir cliente Transfer client: Transferir cliente

View File

@ -39,7 +39,8 @@ class Controller extends Descriptor {
'name', 'name',
'isActive', 'isActive',
'isFreezed', 'isFreezed',
'isTaxDataChecked' 'isTaxDataChecked',
'hasElectronicInvoice',
], ],
include: { include: {
relation: 'salesPersonUser', relation: 'salesPersonUser',

19651
package-lock.json generated

File diff suppressed because it is too large Load Diff