diff --git a/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-domain-mapper.ts b/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-domain-mapper.ts index c02961ff..ca866c49 100644 --- a/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-domain-mapper.ts +++ b/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-domain-mapper.ts @@ -1,7 +1,9 @@ import { Collection, Result, ResultCollection } from "@repo/rdx-utils"; -import { Model } from "sequelize"; -import { MapperParamsType } from "../../../domain"; -import { ISequelizeDomainMapper } from "./sequelize-mapper.interface"; +import type { Model } from "sequelize"; + +import type { MapperParamsType } from "../../../domain"; + +import type { ISequelizeDomainMapper } from "./sequelize-mapper.interface"; export abstract class SequelizeDomainMapper implements ISequelizeDomainMapper diff --git a/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-mapper.interface.ts b/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-mapper.interface.ts index 3b260c4f..2f771669 100644 --- a/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-mapper.interface.ts +++ b/modules/core/src/api/infrastructure/sequelize/mappers/sequelize-mapper.interface.ts @@ -1,4 +1,4 @@ -import { DomainMapperWithBulk, IQueryMapperWithBulk } from "../../../domain"; +import type { DomainMapperWithBulk, IQueryMapperWithBulk } from "../../../domain"; export interface ISequelizeDomainMapper extends DomainMapperWithBulk {} diff --git a/modules/customer-invoices/src/api/application/use-cases/proformas/issue-proforma.use-case.ts b/modules/customer-invoices/src/api/application/use-cases/proformas/issue-proforma.use-case.ts index 6cfabf73..485208aa 100644 --- a/modules/customer-invoices/src/api/application/use-cases/proformas/issue-proforma.use-case.ts +++ b/modules/customer-invoices/src/api/application/use-cases/proformas/issue-proforma.use-case.ts @@ -55,6 +55,7 @@ export class IssueProformaUseCase { proformaId, transaction ); + if (proformaResult.isFailure) return Result.fail(proformaResult.error); const proforma = proformaResult.data; @@ -64,6 +65,7 @@ export class IssueProformaUseCase { proforma.series, transaction ); + if (nextNumberResult.isFailure) return Result.fail(nextNumberResult.error); /** 4. Crear factura definitiva (dominio) */ @@ -71,6 +73,7 @@ export class IssueProformaUseCase { issueNumber: nextNumberResult.data, issueDate: UtcDate.today(), }); + if (issuedInvoiceOrError.isFailure) return Result.fail(issuedInvoiceOrError.error); /** 5. Guardar la nueva factura */ diff --git a/modules/customer-invoices/src/api/application/use-cases/proformas/report-proforma/reporter/templates/customer-invoice/template.hbs b/modules/customer-invoices/src/api/application/use-cases/proformas/report-proforma/reporter/templates/customer-invoice/template.hbs new file mode 100644 index 00000000..8cb8843c --- /dev/null +++ b/modules/customer-invoices/src/api/application/use-cases/proformas/report-proforma/reporter/templates/customer-invoice/template.hbs @@ -0,0 +1,284 @@ + + + + + + + Factura F26200 + + + + + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + {{#each items}} + + + + + + + + + {{/each}} + +
ConceptoUd.Imp. Imp. total
{{description}}{{#if quantity}}{{quantity}}{{else}} {{/if}}{{#if unit_amount}}{{unit_amount}}{{else}} {{/if}}{{#if discount_percentage}}{{discount_percentage}}{{else}} {{/if}}{{#if taxable_amount}}{{taxable_amount}}{{else}} {{/if}}
+
+ +
+ +
+ {{#if payment_method}} +
+

Forma de pago: {{payment_method}}

+
+ {{else}} + + {{/if}} + {{#if notes}} +
+

Notas: {{notes}}

+
+ {{else}} + + {{/if}} + +
+ +
+ + + {{#if discount_percentage}} + + + + + + + + + + + + + {{else}} + + {{/if}} + + + + + + + {{#each taxes}} + + + + + + + {{/each}} + + + + + + + +
Importe neto {{subtotal_amount}}
Descuento {{discount_percentage}} {{discount_amount.value}}
Base imponible {{taxable_amount}}
{{tax_name}} {{taxes_amount}}
+ Total factura +   + {{total_amount}}
+
+
+
+ + +
+ +
+ + + + \ No newline at end of file diff --git a/modules/customer-invoices/src/api/domain/entities/verifactu-record.ts b/modules/customer-invoices/src/api/domain/entities/verifactu-record.ts index c38fef96..f472ed08 100644 --- a/modules/customer-invoices/src/api/domain/entities/verifactu-record.ts +++ b/modules/customer-invoices/src/api/domain/entities/verifactu-record.ts @@ -7,6 +7,8 @@ export interface VerifactuRecordProps { estado: VerifactuRecordEstado; url: Maybe; qrCode: Maybe; + uuid: Maybe; + operacion: Maybe; } export class VerifactuRecord extends DomainEntity { @@ -32,6 +34,14 @@ export class VerifactuRecord extends DomainEntity { return this.props.qrCode; } + get uuid(): Maybe { + return this.props.uuid; + } + + get operacion(): Maybe { + return this.props.operacion; + } + getProps(): VerifactuRecordProps { return this.props; } @@ -45,6 +55,8 @@ export class VerifactuRecord extends DomainEntity { status: this.estado.toString(), url: toEmptyString(this.url, (value) => value.toString()), qr_code: toEmptyString(this.qrCode, (value) => value.toString()), + uuid: toEmptyString(this.uuid, (value) => value.toString()), + operacion: toEmptyString(this.operacion, (value) => value.toString()), }; } } diff --git a/modules/customer-invoices/src/api/domain/services/issue-customer-invoice-domain-service.ts b/modules/customer-invoices/src/api/domain/services/issue-customer-invoice-domain-service.ts index 7eaec3ea..525f259e 100644 --- a/modules/customer-invoices/src/api/domain/services/issue-customer-invoice-domain-service.ts +++ b/modules/customer-invoices/src/api/domain/services/issue-customer-invoice-domain-service.ts @@ -1,13 +1,18 @@ -import type { UtcDate } from "@repo/rdx-ddd"; +import { UniqueID, type UtcDate } from "@repo/rdx-ddd"; import { Maybe, Result } from "@repo/rdx-utils"; import { CustomerInvoice } from "../aggregates"; +import { VerifactuRecord } from "../entities"; import { EntityIsNotProformaError, ProformaCannotBeConvertedToInvoiceError } from "../errors"; import { CustomerInvoiceIsProformaSpecification, ProformaCanTranstionToIssuedSpecification, } from "../specs"; -import { type CustomerInvoiceNumber, CustomerInvoiceStatus } from "../value-objects"; +import { + type CustomerInvoiceNumber, + CustomerInvoiceStatus, + VerifactuRecordEstado, +} from "../value-objects"; /** * Servicio de dominio que encapsula la lógica de emisión de factura definitiva desde una proforma. @@ -43,6 +48,23 @@ export class IssueCustomerInvoiceDomainService { return Result.fail(new ProformaCannotBeConvertedToInvoiceError(proforma.id.toString())); } + const verifactuRecordOrError = VerifactuRecord.create( + { + estado: VerifactuRecordEstado.createPendiente(), + qrCode: Maybe.none(), + url: Maybe.none(), + uuid: Maybe.none(), + operacion: Maybe.none(), + }, + UniqueID.generateNewID() + ); + + if (verifactuRecordOrError.isFailure) { + return Result.fail(new ProformaCannotBeConvertedToInvoiceError(proforma.id.toString())); + } + + const verifactuRecord = verifactuRecordOrError.data; + /** 3. Generar la nueva factura definitiva (inmutable) */ const proformaProps = proforma.getProps(); const newInvoiceOrError = CustomerInvoice.create({ @@ -53,6 +75,7 @@ export class IssueCustomerInvoiceDomainService { invoiceNumber: issueNumber, invoiceDate: issueDate, description: proformaProps.description.isNone() ? Maybe.some(".") : proformaProps.description, + verifactu: Maybe.some(verifactuRecord), }); if (newInvoiceOrError.isFailure) { diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts index 20d1e5f7..b389daa2 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice-item.mapper.ts @@ -1,25 +1,34 @@ -import { ISequelizeDomainMapper, MapperParamsType, SequelizeDomainMapper } from "@erp/core/api"; import { + type ISequelizeDomainMapper, + type MapperParamsType, + SequelizeDomainMapper, +} from "@erp/core/api"; +import { + UniqueID, + ValidationErrorCollection, + type ValidationErrorDetail, extractOrPushError, maybeFromNullableVO, toNullable, - UniqueID, - ValidationErrorCollection, - ValidationErrorDetail, } from "@repo/rdx-ddd"; import { Result } from "@repo/rdx-utils"; + import { - CustomerInvoice, + type CustomerInvoice, CustomerInvoiceItem, CustomerInvoiceItemDescription, - CustomerInvoiceItemProps, - CustomerInvoiceProps, + type CustomerInvoiceItemProps, + type CustomerInvoiceProps, ItemAmount, ItemDiscount, ItemQuantity, ItemTaxes, } from "../../../domain"; -import { CustomerInvoiceItemCreationAttributes, CustomerInvoiceItemModel } from "../../sequelize"; +import type { + CustomerInvoiceItemCreationAttributes, + CustomerInvoiceItemModel, +} from "../../sequelize"; + import { ItemTaxesDomainMapper } from "./item-taxes.mapper"; export interface ICustomerInvoiceItemDomainMapper diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts index 57be06df..5b3db97d 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts @@ -1,31 +1,38 @@ -import { ISequelizeDomainMapper, MapperParamsType, SequelizeDomainMapper } from "@erp/core/api"; +import { + type ISequelizeDomainMapper, + type MapperParamsType, + SequelizeDomainMapper, +} from "@erp/core/api"; import { CurrencyCode, - extractOrPushError, LanguageCode, - maybeFromNullableVO, Percentage, TextValue, - toNullable, UniqueID, UtcDate, ValidationErrorCollection, - ValidationErrorDetail, + type ValidationErrorDetail, + extractOrPushError, + maybeFromNullableVO, + toNullable, } from "@repo/rdx-ddd"; -import { Collection, isNullishOrEmpty, Maybe, Result } from "@repo/rdx-utils"; +import { Collection, Maybe, Result, isNullishOrEmpty } from "@repo/rdx-utils"; + import { CustomerInvoice, CustomerInvoiceItems, CustomerInvoiceNumber, - CustomerInvoiceProps, + type CustomerInvoiceProps, CustomerInvoiceSerie, CustomerInvoiceStatus, InvoicePaymentMethod, } from "../../../domain"; -import { CustomerInvoiceCreationAttributes, CustomerInvoiceModel } from "../../sequelize"; +import type { CustomerInvoiceCreationAttributes, CustomerInvoiceModel } from "../../sequelize"; + import { CustomerInvoiceItemDomainMapper } from "./customer-invoice-item.mapper"; import { InvoiceRecipientDomainMapper } from "./invoice-recipient.mapper"; import { TaxesDomainMapper } from "./invoice-taxes.mapper"; +import { CustomerInvoiceVerifactuDomainMapper } from "./invoice-verifactu.mapper"; export interface ICustomerInvoiceDomainMapper extends ISequelizeDomainMapper< @@ -45,6 +52,7 @@ export class CustomerInvoiceDomainMapper private _itemsMapper: CustomerInvoiceItemDomainMapper; private _recipientMapper: InvoiceRecipientDomainMapper; private _taxesMapper: TaxesDomainMapper; + private _verifactuMapper: CustomerInvoiceVerifactuDomainMapper; constructor(params: MapperParamsType) { super(); @@ -52,6 +60,7 @@ export class CustomerInvoiceDomainMapper this._itemsMapper = new CustomerInvoiceItemDomainMapper(params); // Instanciar el mapper de items this._recipientMapper = new InvoiceRecipientDomainMapper(); this._taxesMapper = new TaxesDomainMapper(params); + this._verifactuMapper = new CustomerInvoiceVerifactuDomainMapper(); } private _mapAttributesToDomain(source: CustomerInvoiceModel, params?: MapperParamsType) { @@ -219,7 +228,22 @@ export class CustomerInvoiceDomainMapper }); }*/ - // 3) Items (colección) + // 3) Verifactu (snapshot en la factura o include) + const verifactuResult = this._verifactuMapper.mapToDomain(source.verifactu, { + errors, + attributes, + ...params, + }); + + /*if (verifactuResult.isFailure) { + errors.push({ + path: "verifactu", + + message: verifactuResult.error.message, + }); + }*/ + + // 4) Items (colección) const itemsResults = this._itemsMapper.mapToDomainCollection( source.items, source.items.length, @@ -249,6 +273,7 @@ export class CustomerInvoiceDomainMapper // 6) Construcción del agregado (Dominio) + const verifactu = verifactuResult.data; const recipient = recipientResult.data; const items = CustomerInvoiceItems.create({ @@ -283,6 +308,7 @@ export class CustomerInvoiceDomainMapper paymentMethod: attributes.paymentMethod!, items, + verifactu, }; const createResult = CustomerInvoice.create(invoiceProps, attributes.invoiceId); @@ -342,7 +368,14 @@ export class CustomerInvoiceDomainMapper ...params, }); - // 4) Si hubo errores de mapeo, devolvemos colección de validación + // 4) Verifactu + const verifactuResult = this._verifactuMapper.mapToPersistence(source.verifactu, { + errors, + parent: source, + ...params, + }); + + // 5) Si hubo errores de mapeo, devolvemos colección de validación if (errors.length > 0) { return Result.fail( new ValidationErrorCollection("Customer invoice mapping to persistence failed", errors) @@ -351,6 +384,7 @@ export class CustomerInvoiceDomainMapper const items = itemsResult.data; const taxes = taxesResult.data; + const verifactu = verifactuResult.data; const allAmounts = source.getAllAmounts(); // Da los totales ya calculados @@ -404,6 +438,7 @@ export class CustomerInvoiceDomainMapper taxes, items, + verifactu, }; return Result.ok( diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-recipient.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-recipient.mapper.ts index 6f0c3858..40319a09 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-recipient.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-recipient.mapper.ts @@ -1,21 +1,22 @@ -import { MapperParamsType } from "@erp/core/api"; +import type { MapperParamsType } from "@erp/core/api"; import { City, Country, - extractOrPushError, - maybeFromNullableVO, Name, PostalCode, Province, Street, TINNumber, - toNullable, ValidationErrorCollection, - ValidationErrorDetail, + type ValidationErrorDetail, + extractOrPushError, + maybeFromNullableVO, + toNullable, } from "@repo/rdx-ddd"; import { Maybe, Result } from "@repo/rdx-utils"; -import { CustomerInvoice, CustomerInvoiceProps, InvoiceRecipient } from "../../../domain"; -import { CustomerInvoiceModel } from "../../sequelize"; + +import { type CustomerInvoice, type CustomerInvoiceProps, InvoiceRecipient } from "../../../domain"; +import type { CustomerInvoiceModel } from "../../sequelize"; export class InvoiceRecipientDomainMapper { public mapToDomain( @@ -133,7 +134,7 @@ export class InvoiceRecipientDomainMapper { const { isProforma, hasRecipient } = parent; // Validación: facturas emitidas deben tener destinatario. - if (!isProforma && !hasRecipient) { + if (!(isProforma || hasRecipient)) { errors.push({ path: "recipient", message: "[CustomerInvoiceDomainMapper] Issued customer invoice without recipient data", diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-verifactu.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-verifactu.mapper.ts new file mode 100644 index 00000000..cbbdb489 --- /dev/null +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/invoice-verifactu.mapper.ts @@ -0,0 +1,142 @@ +import type { MapperParamsType } from "@erp/core/api"; +import { type ISequelizeDomainMapper, SequelizeDomainMapper } from "@erp/core/api"; +import { + URLAddress, + UniqueID, + ValidationErrorCollection, + type ValidationErrorDetail, + extractOrPushError, + maybeFromNullableVO, + toNullable, +} from "@repo/rdx-ddd"; +import { Maybe, Result } from "@repo/rdx-utils"; + +import { + type CustomerInvoice, + type CustomerInvoiceProps, + VerifactuRecord, + VerifactuRecordEstado, +} from "../../../domain"; +import type { VerifactuRecordCreationAttributes, VerifactuRecordModel } from "../../sequelize"; + +export interface ICustomerInvoiceVerifactuDomainMapper + extends ISequelizeDomainMapper< + VerifactuRecordModel, + VerifactuRecordCreationAttributes, + Maybe + > {} + +export class CustomerInvoiceVerifactuDomainMapper + extends SequelizeDomainMapper< + VerifactuRecordModel, + VerifactuRecordCreationAttributes, + Maybe + > + implements ICustomerInvoiceVerifactuDomainMapper +{ + public mapToDomain( + source: VerifactuRecordModel, + params?: MapperParamsType + ): Result, Error> { + const { errors, attributes } = params as { + errors: ValidationErrorDetail[]; + attributes: Partial; + }; + + if (!source) { + return Result.ok(Maybe.none()); + } + + const recordId = extractOrPushError(UniqueID.create(source.id), "id", errors); + const estado = extractOrPushError( + VerifactuRecordEstado.create(source.estado), + "estado", + errors + ); + + const qr = extractOrPushError( + maybeFromNullableVO(source.qr, (value) => Result.ok(String(value))), + "qr", + errors + ); + + const url = extractOrPushError( + maybeFromNullableVO(source.url, (value) => URLAddress.create(value)), + "url", + errors + ); + + const uuid = extractOrPushError( + maybeFromNullableVO(source.uuid, (value) => Result.ok(String(value))), + "uuid", + errors + ); + + const operacion = extractOrPushError( + maybeFromNullableVO(source.operacion, (value) => Result.ok(String(value))), + "operacion", + errors + ); + + if (errors.length > 0) { + return Result.fail( + new ValidationErrorCollection("Verifactu record mapping failed [mapToDTO]", errors) + ); + } + + const createResult = VerifactuRecord.create( + { + estado: estado!, + qrCode: qr!, + url: url!, + uuid: uuid!, + operacion: operacion!, + }, + recordId! + ); + + if (createResult.isFailure) { + return Result.fail( + new ValidationErrorCollection("Invoice verifactu entity creation failed", [ + { path: "verifactu", message: createResult.error.message }, + ]) + ); + } + + return Result.ok(Maybe.some(createResult.data)); + } + + mapToPersistence( + source: Maybe, + params?: MapperParamsType + ): Result { + const { errors, parent } = params as { + parent: CustomerInvoice; + errors: ValidationErrorDetail[]; + }; + + if (source.isNone()) { + return Result.ok({ + id: UniqueID.generateNewID().toPrimitive(), + invoice_id: parent.id.toPrimitive(), + estado: VerifactuRecordEstado.createPendiente().toPrimitive(), + qr: null, + url: null, + uuid: null, + operacion: null, + }); + } + + const verifactu = source.unwrap(); + + return Result.ok({ + id: verifactu.id.toPrimitive(), + invoice_id: parent.id.toPrimitive(), + estado: verifactu.estado.toPrimitive(), + qr: toNullable(verifactu.qrCode, (v) => v), + url: toNullable(verifactu.url, (v) => v.toPrimitive()), + uuid: toNullable(verifactu.uuid, (v) => v), + operacion: toNullable(verifactu.operacion, (v) => v), + }); + } +} diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/queries/verifactu-record.list.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/queries/verifactu-record.list.mapper.ts index 3f03edd4..9b053e60 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/queries/verifactu-record.list.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/queries/verifactu-record.list.mapper.ts @@ -46,6 +46,18 @@ export class VerifactuRecordListMapper errors ); + const uuid = extractOrPushError( + maybeFromNullableVO(raw.uuid, (value) => Result.ok(String(value))), + "uuid", + errors + ); + + const operacion = extractOrPushError( + maybeFromNullableVO(raw.operacion, (value) => Result.ok(String(value))), + "operacion", + errors + ); + if (errors.length > 0) { return Result.fail( new ValidationErrorCollection("Verifactu record mapping failed [mapToDTO]", errors) @@ -57,6 +69,8 @@ export class VerifactuRecordListMapper estado: estado!, qrCode: qr!, url: url!, + uuid: uuid!, + operacion: operacion!, }, recordId! ); diff --git a/modules/customer-invoices/src/api/infrastructure/sequelize/models/customer-invoice.model.ts b/modules/customer-invoices/src/api/infrastructure/sequelize/models/customer-invoice.model.ts index 531cba0d..41f03508 100644 --- a/modules/customer-invoices/src/api/infrastructure/sequelize/models/customer-invoice.model.ts +++ b/modules/customer-invoices/src/api/infrastructure/sequelize/models/customer-invoice.model.ts @@ -17,14 +17,18 @@ import type { CustomerInvoiceTaxCreationAttributes, CustomerInvoiceTaxModel, } from "./customer-invoice-tax.model"; -import type { VerifactuRecordModel } from "./verifactu-record.model"; +import type { + VerifactuRecordCreationAttributes, + VerifactuRecordModel, +} from "./verifactu-record.model"; export type CustomerInvoiceCreationAttributes = InferCreationAttributes< CustomerInvoiceModel, - { omit: "items" | "taxes" | "current_customer" } + { omit: "items" | "taxes" | "current_customer" | "verifactu" } > & { items?: CustomerInvoiceItemCreationAttributes[]; taxes?: CustomerInvoiceTaxCreationAttributes[]; + verifactu?: VerifactuRecordCreationAttributes; }; export class CustomerInvoiceModel extends Model< diff --git a/modules/customer-invoices/src/api/infrastructure/sequelize/models/verifactu-record.model.ts b/modules/customer-invoices/src/api/infrastructure/sequelize/models/verifactu-record.model.ts index b102d8ef..117320c6 100644 --- a/modules/customer-invoices/src/api/infrastructure/sequelize/models/verifactu-record.model.ts +++ b/modules/customer-invoices/src/api/infrastructure/sequelize/models/verifactu-record.model.ts @@ -1,4 +1,5 @@ import { + type CreationOptional, DataTypes, type InferAttributes, type InferCreationAttributes, @@ -6,7 +7,10 @@ import { type Sequelize, } from "sequelize"; -export type VerifactuRecordCreationAttributes = InferCreationAttributes; +export type VerifactuRecordCreationAttributes = InferCreationAttributes< + VerifactuRecordModel, + { omit: "url" | "qr" | "uuid" | "operacion" } +>; export class VerifactuRecordModel extends Model< InferAttributes, @@ -14,13 +18,12 @@ export class VerifactuRecordModel extends Model< > { declare id: string; declare invoice_id: string; - declare estado: string; - declare url: string; - declare qr: Blob; - declare uuid: string; - declare operacion: string; + declare url: CreationOptional; + declare qr: CreationOptional; + declare uuid: CreationOptional; + declare operacion: CreationOptional; static associate(database: Sequelize) { const models = database.models; @@ -64,29 +67,31 @@ export default (database: Sequelize) => { estado: { type: new DataTypes.TEXT(), - allowNull: true, - defaultValue: null, + allowNull: false, }, url: { type: new DataTypes.TEXT(), allowNull: false, + defaultValue: "", }, qr: { type: new DataTypes.BLOB(), allowNull: false, + defaultValue: "", }, uuid: { type: DataTypes.STRING, allowNull: false, + defaultValue: "", }, operacion: { type: DataTypes.STRING, - allowNull: true, - defaultValue: null, + allowNull: false, + defaultValue: "", }, }, { diff --git a/modules/customer-invoices/src/common/locales/es.json b/modules/customer-invoices/src/common/locales/es.json index 4cb20b2f..fcd0b845 100644 --- a/modules/customer-invoices/src/common/locales/es.json +++ b/modules/customer-invoices/src/common/locales/es.json @@ -28,11 +28,11 @@ "proformas": { "status": { "all": "Todas", - "draft": "Borradores", - "sent": "Enviadas", - "approved": "Aprovadas", - "rejected": "Rechazadas", - "issued": "Emitidas" + "draft": "Borrador", + "sent": "Enviada", + "approved": "Aprobada", + "rejected": "Rechazada", + "issued": "Emitida" } }, "issued_invoices": {