Skip to content

Commit fc20aaf

Browse files
authored
Fix negative sign in formula output disappears when cell is selected (baserow#5167)
1 parent 8383f02 commit fc20aaf

5 files changed

Lines changed: 24 additions & 2 deletions

File tree

backend/src/baserow/contrib/database/api/formula/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Meta:
1919
model = FormulaField
2020
fields = list(
2121
set(FormulaFieldType.serializer_field_names)
22-
- {"available_collaborators", "select_options"}
22+
- {"available_collaborators", "select_options", "number_negative"}
2323
)
2424

2525

backend/src/baserow/contrib/database/formula/types/formula_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def get_serializer_field_names(cls) -> List[str]:
139139
return cls.all_fields()
140140

141141
@classmethod
142-
def get_serializer_field_overrides(cls) -> List[str]:
142+
def get_serializer_field_overrides(cls) -> dict[str, any]:
143143
return {}
144144

145145
@property

backend/src/baserow/contrib/database/formula/types/formula_types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,18 @@ class BaserowFormulaNumberType(
379379
can_group_by = True
380380
can_have_db_index = True
381381

382+
@classmethod
383+
def get_serializer_field_names(cls):
384+
return super().get_serializer_field_names() + ["number_negative"]
385+
386+
@classmethod
387+
def get_serializer_field_overrides(cls):
388+
return super().get_serializer_field_overrides() | {
389+
"number_negative": serializers.BooleanField(
390+
required=False, read_only=True, default=True
391+
),
392+
}
393+
382394
def __init__(
383395
self,
384396
number_decimal_places: int,

backend/tests/baserow/contrib/database/field/test_formula_field_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,7 @@ def test_updating_formula_field_doesnt_reset_all_fields(data_fixture, api_client
14511451
"formula_type": "date",
14521452
"nullable": True,
14531453
"number_decimal_places": None,
1454+
"number_negative": True,
14541455
}
14551456
actual = {key: value for key, value in response.json().items() if key in expected}
14561457
assert actual == expected
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bug",
3+
"message": "Fix negative sign in formula output disappearing when a cell is selected",
4+
"issue_origin": "github",
5+
"issue_number": 4323,
6+
"domain": "database",
7+
"bullet_points": [],
8+
"created_at": "2026-04-10"
9+
}

0 commit comments

Comments
 (0)