Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account_invoice_constraint_chronology: fix issue with already numbered invoice #1934

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading