Skip to content

Calculator refactor#1907

Merged
NeoRazorX merged 16 commits intomasterfrom
calculator-refactor
Mar 11, 2026
Merged

Calculator refactor#1907
NeoRazorX merged 16 commits intomasterfrom
calculator-refactor

Conversation

@NeoRazorX
Copy link
Copy Markdown
Owner

Descripción

  • Describe los cambios que has hecho en el código.
  • No incluyas diferentes funcionalidades en un mismo PR, es decir, si cambias el listado de usuarios, no modifiques también la impresión en PDF.
  • Funcionalidades distintas deben ir en pull requests separados.
  • No modifiques las traducciones. Las traducciones se gestionan desde https://facturascripts.com/traducciones/
  • Borra estas líneas, son solo para que las leas.
  • No es necesario que escribas esto en inglés si ya lo escribes en español.

Description (english)

  • Describe the changes you have made to the code.
  • Do not include different features in the same PR, i.e. if you change the list of users, do not change the printing in PDF.
  • Different features should be in separate PRs.
  • Do not modify the translations. The translations are managed from https://facturascripts.com/translations/
  • Remove these lines, they are only to let you read them.

¿Cómo has probado los cambios?

Toda modificación debe haber sido mínimamente probada. Marca o describe las pruebas que has realizado:

  • He revisado mi código antes de enviarlo.
  • He probado que funciona correctamente en mi PC.
  • He probado que funciona correctamente con una base de datos vacía.
  • He ejecutado los tests unitarios.

How has the changes been tested? (english)

Any modification must have been tested minimally. Mark or describe the tests you have performed:

  • I have reviewed my code before sending it.
  • I have tested it on my PC.
  • I have tested it on an empty database.
  • I have run the unit tests.

Ayuda

Aquí tienes algunos enlaces de ayuda:

Help (english)

Here are some help links:

Carlos Garcia and others added 16 commits March 5, 2026 19:45
…dores para que quepan todos los valores de RegimenIVA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add missing `use RegimenIVA` in Calculator that would cause a fatal error.
Simplify E3 (art. 22) and E4 (arts. 23-24) validations in CalculatorModSpain
to always reject IVA > 0, consistent with E1 and E6, removing confusing
country/NIF conditions that contradicted the warning messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… document models

- Correct recargo de equivalencia logic: apply RE based on customer regime
  for sales and company regime for purchases
- Add calculateLine() to CalculatorModSpain to enforce recargo rules early
  when creating new document lines
- Add calculateLine() call in PurchaseDocument::getNewProductLine() and
  skip duplicate call in getNewLine() when called from getNewProductLine()
- Add intra-community subcuentas (4721/4771) to Impuesto model and
  accounting entries in InvoiceToAccounting
- Add excepcioniva field to EditImpuestoZona.xml with exception list loading
- Add CSV delimiter fallback when ParseCsv auto-detection fails
- Update ESP default plan with 6 new intra-community subaccounts
- Fix related tests for new RE behavior and intra-community accounting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove unnecessary & on object params (BusinessDocument, BusinessDocumentLine)
for consistency with CalculatorModClass. Add missing RegimenIVA import.
Add unit tests for Spanish tax operations: intra-community, reverse charge,
export, import, gold, REAGYP, used goods (REBU) and travel agency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change retention icon to fa-minus-circle to differentiate from taxes.
Add sorting options to ListImpuesto (vat, surcharge, percentage).
Reorganize EditImpuesto columns and separate accounting subaccounts
into their own group. Adjust EditRetencion column widths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix applyUsedGoods and applyTravel: neto was set to totalCoste
instead of pvpTotal when margin was negative, causing wrong document
totals. Now always accumulate margin in neto and only apply IVA when
margin is positive or serie is rectificativa.

Move 4 Spain-specific tests from CalculatorTest to CalculatorModSpainTest
and add 9 new tests: negative margin (REBU and travel, normal and
rectificativa), export on purchase, import on sale, REBU with normal
product, travel agency purchase, intra-community purchase with multiple
rates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add allForPurchases() and allForSales() methods to InvoiceOperation
so that only relevant operations are shown in each context: export,
successive tract and work certification for sales only; import for
purchases only; the rest for both. Update EditCliente, EditProveedor
and CommonSalesPurchases to use the filtered methods. Add unit test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NeoRazorX NeoRazorX merged commit 31fdfe0 into master Mar 11, 2026
17 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant