Skip to content
Merged
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
1 change: 1 addition & 0 deletions changelog.d/31.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mark expiry_date fields as optional
4 changes: 2 additions & 2 deletions docs/managers/credit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions docs/managers/grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion docs/managers/voucher-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
6 changes: 3 additions & 3 deletions openstack_odooclient/managers/credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""
Expand Down
6 changes: 3 additions & 3 deletions openstack_odooclient/managers/grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
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
from ..base.record_manager.base import RecordManagerBase


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."""
Expand Down
2 changes: 1 addition & 1 deletion openstack_odooclient/managers/voucher_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down