refs #6213 fixCreateError
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2023-09-11 12:32:46 +02:00
parent 08e97b6a19
commit ccfd8fad05
5 changed files with 25 additions and 5 deletions

View File

@ -0,0 +1 @@
ALTER TABLE vn.supplier ADD CONSTRAINT supplier_CHECK CHECK (LENGTH(account) = 10);

View File

@ -216,6 +216,7 @@
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
"The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
"The item is required": "El artículo es requerido",
@ -307,14 +308,15 @@
"Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}",
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
"You don't have enough privileges.": "No tienes suficientes permisos.",
"This ticket is locked.": "Este ticket está bloqueado.",
"This ticket is not editable.": "Este ticket no es editable.",
"The ticket doesn't exist.": "No existe el ticket.",
"Social name should be uppercase": "La razón social debe ir en mayúscula",
"Social name should be uppercase": "La razón social debe ir en mayúscula",
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
"Ticket without Route": "Ticket sin ruta"
}
"Ticket without Route": "Ticket sin ruta",
"The account size must be exactly 10 characters": "The account size must be exactly 10 characters"
}

View File

@ -112,9 +112,26 @@ module.exports = Self => {
const hasChanges = orgData && changes;
const isPayMethodCheckedChanged = hasChanges
&& orgData.isPayMethodChecked != isPayMethodChecked;
const isAccountChanged = hasChanges && orgData.account != changes.account;
if (!editPayMethodCheck && isPayMethodCheckedChanged)
throw new UserError('You can not modify is pay method checked');
if (isAccountChanged && !(changes.account.length === 10))
throw new UserError('The account size must be exactly 10 characters');
});
Self.observe('after save', async function(ctx) {
if (ctx.instance && ctx.isNewInstance) {
const supplierId = ctx.instance.id;
const models = Self.app.models;
const supplier = await models.Supplier.findById(supplierId);
await supplier.updateAttribute(
'account',
supplierId.toString().padStart(10, '0')
);
}
});
Self.validateAsync('name', 'countryFk', hasSupplierSameName, {

View File

@ -18,7 +18,6 @@
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Create">
</vn-submit>
<vn-button

View File

@ -4,6 +4,7 @@ import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
console.log($.name);
}
onSubmit() {