Skip to content

Commit 38fc2e7

Browse files
authored
Merge pull request #282 from invopop/mx-empty-line-taxes
MX: allow line taxes to be empty
2 parents 091a1f0 + cd7c378 commit 38fc2e7

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to GOBL will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). See also the [GOBL versions](https://docs.gobl.org/overview/versions) documentation site for more details.
66

7+
## [v0.75.1] - 2024-05-07
8+
9+
### Change
10+
11+
- MX: allow line taxes to be empty.
12+
713
## [v0.75.0] - 2024-05-06
814

915
### Added

regimes/mx/invoice.go

-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ func (v *invoiceValidator) validLine(value interface{}) error {
125125
return validation.ValidateStruct(line,
126126
validation.Field(&line.Quantity, num.Positive),
127127
validation.Field(&line.Total, num.Positive),
128-
validation.Field(&line.Taxes,
129-
validation.Required,
130-
validation.Skip, // Prevents each tax's `ValidateWithContext` function from being called again.
131-
),
132128
)
133129
}
134130

regimes/mx/invoice_test.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ func TestLineValidation(t *testing.T) {
130130

131131
inv.Lines[0].Item.Price = num.MakeAmount(-1, 0)
132132
assertValidationError(t, inv, "lines: (0: (total: must be greater than 0.).)")
133-
134-
inv = validInvoice()
135-
136-
inv.Lines[0].Taxes = nil
137-
assertValidationError(t, inv, "lines: (0: (taxes: cannot be blank.).)")
138133
}
139134

140135
func TestPaymentInstructionsValidation(t *testing.T) {
@@ -228,6 +223,7 @@ func TestInvoiceDiscountValidation(t *testing.T) {
228223
}
229224

230225
func assertValidationError(t *testing.T, inv *bill.Invoice, expected string) {
226+
t.Helper()
231227
require.NoError(t, inv.Calculate())
232228
err := inv.Validate()
233229
require.Error(t, err)

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
type Version string
99

1010
// VERSION is the current version of the GOBL library.
11-
const VERSION Version = "v0.75.0"
11+
const VERSION Version = "v0.75.1"
1212

1313
// Semver parses and returns semver
1414
func (v Version) Semver() *semver.Version {

0 commit comments

Comments
 (0)