Refactor VerifactuRecordModel associations and update proforma reference field name

This commit is contained in:
David Arranz 2026-07-16 12:31:44 +02:00
parent e7a6fb0242
commit 65015c8c4f
2 changed files with 3 additions and 11 deletions

View File

@ -27,7 +27,7 @@ export class VerifactuRecordModel extends Model<
static associate(database: Sequelize) { static associate(database: Sequelize) {
const models = database.models; const models = database.models;
const requiredModels = ["CustomerInvoiceModel", "IssuedInvoiceModel"]; const requiredModels = ["IssuedInvoiceModel"];
// Comprobamos que los modelos existan // Comprobamos que los modelos existan
for (const name of requiredModels) { for (const name of requiredModels) {
@ -36,15 +36,7 @@ export class VerifactuRecordModel extends Model<
} }
} }
const { CustomerInvoiceModel, IssuedInvoiceModel } = models; const { IssuedInvoiceModel } = models;
/*VerifactuRecordModel.belongsTo(CustomerInvoiceModel, {
as: "legacy_invoice",
targetKey: "id",
foreignKey: "invoice_id",
onDelete: "CASCADE",
onUpdate: "CASCADE",
});*/
VerifactuRecordModel.belongsTo(IssuedInvoiceModel, { VerifactuRecordModel.belongsTo(IssuedInvoiceModel, {
as: "issued_invoice", as: "issued_invoice",

View File

@ -41,7 +41,7 @@ export const ProformaUpdateHeaderEditor = ({
disabled={true} disabled={true}
label={t("form_fields.proformas.invoice_number.label")} label={t("form_fields.proformas.invoice_number.label")}
maxLength={16} maxLength={16}
name="invoiceNumber" name="proformaReference"
placeholder={t("form_fields.proformas.invoice_number.placeholder")} placeholder={t("form_fields.proformas.invoice_number.placeholder")}
readOnly={true} readOnly={true}
rightIcon={ rightIcon={