Skip to content

Commit

Permalink
[FIX] account_invoice_constraint_chronology: fix issue with already n…
Browse files Browse the repository at this point in the history
…umbered invoice

An already numbered invoice should not conflict with future draft invoices named /.
  • Loading branch information
sbidoul committed Sep 11, 2024
1 parent 95d96c6 commit 5a13267
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions account_invoice_constraint_chronology/model/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _conflicting_inv_after_sequence_before_inv_date_domain(self):
[
(
("name", ">", self.name),
("name", "!=", "/"),
("invoice_date", "<", self.invoice_date),
)
]
Expand All @@ -106,6 +107,7 @@ def _conflicting_inv_before_sequence_after_inv_date_domain(self):
[
(
("name", "<", self.name),
("name", "!=", "/"),
("invoice_date", ">", self.invoice_date),
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,12 @@ def test_modify_invoice_date_validated_past_invoice(self):
),
):
self.invoice_1_a_15.action_post()

def test_post_invoice_with_name(self):
# invoice 1 has a number (not /)
assert self.invoice_1.state == "draft"
assert self.invoice_1.name > "/"
# invoice 2 is dated after invoice 1 and is named '/'
invoice2 = self.invoice_1.copy()
invoice2.invoice_date = self.invoice_1.invoice_date + timedelta(days=1)
self.invoice_1.action_post()

0 comments on commit 5a13267

Please sign in to comment.