refs #6213 fixCreateError
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
08e97b6a19
commit
ccfd8fad05
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.supplier ADD CONSTRAINT supplier_CHECK CHECK (LENGTH(account) = 10);
|
|
@ -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",
|
||||
|
@ -316,5 +317,6 @@
|
|||
"The ticket doesn't exist.": "No existe el ticket.",
|
||||
"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"
|
||||
}
|
|
@ -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, {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Create">
|
||||
</vn-submit>
|
||||
<vn-button
|
||||
|
|
|
@ -4,6 +4,7 @@ import Section from 'salix/components/section';
|
|||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
console.log($.name);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
Loading…
Reference in New Issue