Campos en cliente y facturas para relacionar con FactuGES
This commit is contained in:
parent
92d7fb4ca6
commit
b25ebba733
@ -37,8 +37,13 @@ export class CustomerInvoiceModel extends Model<
|
||||
declare id: string;
|
||||
declare company_id: string;
|
||||
|
||||
// status === issued <- (si is_proforma === true) => Es una proforma (histórica)
|
||||
// status === issued <- (si is_proforma === false) => Factura y enviada a Veri*Factu
|
||||
declare is_proforma: boolean;
|
||||
declare status: string;
|
||||
|
||||
declare proforma_id: CreationOptional<string | null>; // ID de la proforma origen de la factura
|
||||
|
||||
declare series: CreationOptional<string | null>;
|
||||
declare invoice_number: CreationOptional<string | null>;
|
||||
declare invoice_date: CreationOptional<string>;
|
||||
@ -90,6 +95,9 @@ export class CustomerInvoiceModel extends Model<
|
||||
declare customer_postal_code: CreationOptional<string | null>;
|
||||
declare customer_country: CreationOptional<string | null>;
|
||||
|
||||
// FactuGES
|
||||
declare factuges_id: CreationOptional<string | null>;
|
||||
|
||||
// Relaciones
|
||||
declare items: NonAttribute<CustomerInvoiceItemModel[]>;
|
||||
declare taxes: NonAttribute<CustomerInvoiceTaxModel[]>;
|
||||
@ -111,6 +119,7 @@ export class CustomerInvoiceModel extends Model<
|
||||
}
|
||||
}
|
||||
|
||||
// Los modelos existen
|
||||
const {
|
||||
CustomerInvoiceModel,
|
||||
CustomerInvoiceItemModel,
|
||||
@ -171,6 +180,12 @@ export default (database: Sequelize) => {
|
||||
defaultValue: true,
|
||||
},
|
||||
|
||||
proforma_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: true,
|
||||
defaultValue: true,
|
||||
},
|
||||
|
||||
status: {
|
||||
type: new DataTypes.STRING(),
|
||||
allowNull: false,
|
||||
@ -364,6 +379,12 @@ export default (database: Sequelize) => {
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
factuges_id: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize: database,
|
||||
@ -385,7 +406,8 @@ export default (database: Sequelize) => {
|
||||
},
|
||||
{ name: "idx_invoice_date", fields: ["invoice_date"] }, // <- para ordenación
|
||||
{ name: "idx_company_idx", fields: ["id", "company_id"], unique: true }, // <- para consulta get
|
||||
|
||||
{ name: "idx_proforma_id", fields: ["proforma_id"], unique: false },
|
||||
{ name: "idx_factuges", fields: ["factuges_id"], unique: false }, // <- para el proceso python
|
||||
{
|
||||
name: "ft_customer_invoice",
|
||||
type: "FULLTEXT",
|
||||
|
||||
@ -56,6 +56,7 @@ export class CustomerModel extends Model<
|
||||
declare language_code: CreationOptional<string>;
|
||||
declare currency_code: CreationOptional<string>;
|
||||
|
||||
// FactuGES
|
||||
declare factuges_id: CreationOptional<string | null>;
|
||||
|
||||
static associate(_database: Sequelize) {}
|
||||
@ -238,6 +239,8 @@ export default (database: Sequelize) => {
|
||||
},
|
||||
{ name: "idx_name", fields: ["name"] }, // <- para ordenación
|
||||
{ name: "idx_company_idx", fields: ["id", "company_id"], unique: true }, // <- para consulta get
|
||||
{ name: "idx_factuges", fields: ["factuges_id"], unique: true }, // <- para el proceso python
|
||||
|
||||
{
|
||||
name: "ft_customer",
|
||||
type: "FULLTEXT",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user