Skip to content

Commit 852f056

Browse files
committed
[IMP] estate: ignore button click when the property is already cancelled
Ignore the button click to mark a property as cancelled if the property is already cancelled. This is more user-friendly than raising an error.
1 parent ab41357 commit 852f056

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

estate/models/estate_property.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ def action_set_sold(self) -> bool:
8585

8686
def action_set_cancelled(self) -> bool:
8787
for record in self:
88+
if record.state == "cancelled":
89+
continue
90+
8891
if record.state == "sold":
8992
raise UserError(_("Sold properties cannot be cancelled."))
9093

91-
if record.state == "cancelled":
92-
raise UserError(_("This property has already been cancelled."))
93-
9494
record.state = "cancelled"
9595
return True
9696

0 commit comments

Comments
 (0)