Crear un plugin
Estructura minima
export const init = async ({ hooks, migration, factuApi }) => { console.log('[Mi Plugin] Inicializado');};Añadir campos
await migration.addCustomField({ pluginId: 'mi-plugin', tableName: 'BusinessPartner', fieldName: 'loyalty_points', type: 'INTEGER', label: 'Puntos de fidelidad',});Hooks
hooks.register('salesInvoice.beforeCreate', async (ctx) => { if (ctx.data.total > 10000) { throw new Error('Limite excedido'); }});Eventos disponibles: {tipo}.beforeCreate, {tipo}.afterCreate
Tipos: salesInvoice, purchaseInvoice, salesOrder, purchaseOrder, salesDeliveryNote, purchaseDeliveryNote