Skip to content

Commit a620049

Browse files
committed
Adjust tax combo extension validations
1 parent 85bb57e commit a620049

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

addons/es/sii/extensions.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ var extensions = []*cbc.Definition{
426426
| ~S1~ | ~standard~, ~reduced~, ~super-reduced~, ~zero~ |
427427
| ~S2~ | ~reverse-charge~ |
428428
429-
Maps to the ~TipoNoExenta~ field. Values correspond to the L7 list.
429+
Maps to the ~TipoNoExenta~ field. Values correspond to the L7 list. The ~S3~ code is not
430+
meant to be set manually, it will only be set internally when both ~S1~ and ~S2~ are present
431+
in the same invoice.
430432
431433
Note: This extension is **mutually exclusive** with ~es-sii-exempt~ and ~es-sii-not-subject~.
432434
Only one of these three extensions can be used for a given tax combo.

addons/es/sii/tax_combo.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,12 @@ func validateTaxCombo(tc *tax.Combo) error {
7777
validation.Required,
7878
// Regime is always required for VAT and IGIC
7979
tax.ExtensionsRequire(ExtKeyRegime),
80+
extensionsRequireOneOf(ExtKeyNotSubject, ExtKeyExempt, ExtKeyNotExempt),
8081
validation.When(
8182
tc.Percent != nil, // Subject and not exempt
82-
tax.ExtensionsRequire(ExtKeyNotExempt),
83-
tax.ExtensionsExclude(ExtKeyNotSubject, ExtKeyExempt),
84-
),
85-
validation.When(
86-
tc.Percent == nil, // Exempt or not subject
87-
extensionsRequireOneOf(ExtKeyNotSubject, ExtKeyExempt),
88-
tax.ExtensionsExclude(ExtKeyNotExempt),
83+
extensionsRequireOneOf(ExtKeyNotSubject, ExtKeyNotExempt),
8984
),
85+
tax.ExtensionsExcludeCodes(ExtKeyNotExempt, "S3"), // S3 can only be set by the converter when both S1 and S2 are present
9086
// https://sede.agenciatributaria.gob.es/static_files/Sede/Procedimiento_ayuda/G417/FicherosSuministros/V_1_1/Validaciones_ErroresSII_v1.1.pdf (Page 51, point 11)
9187
validation.When(
9288
tc.Ext.Get(ExtKeyRegime).In("01"),

0 commit comments

Comments
 (0)