From 88da628bc9c064c4e1743033b4b95481da4fe6f6 Mon Sep 17 00:00:00 2001 From: Callum Dickinson Date: Mon, 2 Mar 2026 10:53:06 +1300 Subject: [PATCH] Mark expiry_date fields as optional All `expiry_date` fields are optional. Fix their type hints and descriptions to reflect the fact they can not be set. --- changelog.d/31.fixed.md | 1 + docs/managers/credit.md | 4 ++-- docs/managers/grant.md | 4 ++-- docs/managers/voucher-code.md | 2 +- openstack_odooclient/managers/credit.py | 6 +++--- openstack_odooclient/managers/grant.py | 6 +++--- openstack_odooclient/managers/voucher_code.py | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 changelog.d/31.fixed.md diff --git a/changelog.d/31.fixed.md b/changelog.d/31.fixed.md new file mode 100644 index 0000000..6604fa8 --- /dev/null +++ b/changelog.d/31.fixed.md @@ -0,0 +1 @@ +Mark expiry_date fields as optional diff --git a/docs/managers/credit.md b/docs/managers/credit.md index 6bff3d8..f0424b6 100644 --- a/docs/managers/credit.md +++ b/docs/managers/credit.md @@ -86,10 +86,10 @@ The current remaining balance on the credit. ### `expiry_date` ```python -expiry_date: date +expiry_date: date | Literal[False] ``` -The date the credit expires. +The date the credit expires, if an expiry date is set. ### `initial_balance` diff --git a/docs/managers/grant.md b/docs/managers/grant.md index ea5d01c..db74988 100644 --- a/docs/managers/grant.md +++ b/docs/managers/grant.md @@ -51,10 +51,10 @@ see [Record Attributes and Methods](index.md#attributes-and-methods). ### `expiry_date` ```python -expiry_date: date +expiry_date: date | Literal[False] ``` -The date the grant expires. +The date the grant expires, if an expiry date is set. ### `grant_type_id` diff --git a/docs/managers/voucher-code.md b/docs/managers/voucher-code.md index 1db62b7..d9225d7 100644 --- a/docs/managers/voucher-code.md +++ b/docs/managers/voucher-code.md @@ -145,7 +145,7 @@ and caches it for subsequent accesses. expiry_date: date | Literal[False] ``` -The date the voucher code expires. +The date the voucher code expires, if an expiry date is set. ### `grant_duration` diff --git a/openstack_odooclient/managers/credit.py b/openstack_odooclient/managers/credit.py index fe47a18..aa1a28e 100644 --- a/openstack_odooclient/managers/credit.py +++ b/openstack_odooclient/managers/credit.py @@ -16,7 +16,7 @@ from __future__ import annotations from datetime import date -from typing import Annotated +from typing import Annotated, Literal from ..base.record.base import RecordBase from ..base.record.types import ModelRef @@ -40,8 +40,8 @@ class Credit(RecordBase["CreditManager"]): current_balance: float """The current remaining balance on the credit.""" - expiry_date: date - """The date the credit expires.""" + expiry_date: date | Literal[False] + """The date the credit expires, if an expiry date is set.""" initial_balance: float """The initial balance this credit started off with.""" diff --git a/openstack_odooclient/managers/grant.py b/openstack_odooclient/managers/grant.py index aaca55c..c533561 100644 --- a/openstack_odooclient/managers/grant.py +++ b/openstack_odooclient/managers/grant.py @@ -16,7 +16,7 @@ from __future__ import annotations from datetime import date -from typing import Annotated +from typing import Annotated, Literal from ..base.record.base import RecordBase from ..base.record.types import ModelRef @@ -24,8 +24,8 @@ class Grant(RecordBase["GrantManager"]): - expiry_date: date - """The date the grant expires.""" + expiry_date: date | Literal[False] + """The date the grant expires, if an expiry date is set.""" grant_type_id: Annotated[int, ModelRef("grant_type", GrantType)] """The ID of the type of this grant.""" diff --git a/openstack_odooclient/managers/voucher_code.py b/openstack_odooclient/managers/voucher_code.py index 8f78a8e..a5bdabf 100644 --- a/openstack_odooclient/managers/voucher_code.py +++ b/openstack_odooclient/managers/voucher_code.py @@ -91,7 +91,7 @@ class VoucherCode( """ expiry_date: date | Literal[False] - """The date the voucher code expires.""" + """The date the voucher code expires, if an expiry date is set.""" grant_duration: int | Literal[False] """The duration of the grant, in days, if a grant is to be