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/22.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add tax fields to record types
24 changes: 24 additions & 0 deletions docs/managers/account-move-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,27 @@ quantity: float
```

Quantity of product charged on the account move (invoice) line.

### `tax_ids`

```python
tax_ids: list[int]
```

The list of IDs for the taxes that are applied
on this account move (invoice) line.

*Added in version 0.2.3.*

### `taxes`

```python
taxes: list[Tax]
```

The list of taxes that are applied on this account move (invoice) line.

This fetches the full records from Odoo once,
and caches them for subsequent accesses.

*Added in version 0.2.3.*
34 changes: 34 additions & 0 deletions docs/managers/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,40 @@ Whether or not this product is sellable.

*Added in version 0.2.1.*

### `tax_ids`

```python
tax_ids: list[int]
```

An alias for [``taxes_id``](#taxes_id).

*Added in version 0.2.3.*

### `taxes_id`

```python
taxes_id: list[int]
```

The list of IDs for the default taxes that are used
when selling this product.

*Added in version 0.2.3.*

### `taxes`

```python
taxes: list[Tax]
```

The list of default taxes used when selling this product.

This fetches the full records from Odoo once,
and caches them for subsequent accesses.

*Added in version 0.2.3.*

### `uom_id`

```python
Expand Down
17 changes: 17 additions & 0 deletions openstack_odooclient/managers/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ class AccountMoveLine(RecordBase["AccountMoveLineManager"]):
quantity: float
"""Quantity of product charged on the account move (invoice) line."""

tax_ids: Annotated[list[int], ModelRef("tax_ids", Tax)]
"""The list of IDs for the taxes that are applied
on this account move (invoice) line.

*Added in version 0.2.3.*
"""

taxes: Annotated[list[Tax], ModelRef("tax_ids", Tax)]
"""The list of taxes that are applied on this account move (invoice) line.

This fetches the full records from Odoo once,
and caches them for subsequent accesses.

*Added in version 0.2.3.*
"""


class AccountMoveLineManager(RecordManagerBase[AccountMoveLine]):
env_name = "account.move.line"
Expand All @@ -141,3 +157,4 @@ class AccountMoveLineManager(RecordManagerBase[AccountMoveLine]):
from .currency import Currency # noqa: E402
from .product import Product # noqa: E402
from .project import Project # noqa: E402
from .tax import Tax # noqa: E402
25 changes: 24 additions & 1 deletion openstack_odooclient/managers/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import TYPE_CHECKING, Annotated, Any, Literal, overload

from ..base.record.base import RecordBase
from ..base.record.types import ModelRef
from ..base.record.types import FieldAlias, ModelRef
from ..base.record_manager.base import RecordManagerBase

if TYPE_CHECKING:
Expand Down Expand Up @@ -88,6 +88,28 @@ class Product(RecordBase["ProductManager"]):
*Added in version 0.2.1.*
"""

tax_ids: Annotated[list[int], FieldAlias("taxes_id")]
"""An alias for ``taxes_id``.

*Added in version 0.2.3.*
"""

taxes_id: Annotated[list[int], ModelRef("taxes_id", Tax)]
"""The list of IDs for the default taxes that are used
when selling this product.

*Added in version 0.2.3.*
"""

taxes: Annotated[list[Tax], ModelRef("taxes_id", Tax)]
"""The list of default taxes used when selling this product.

This fetches the full records from Odoo once,
and caches them for subsequent accesses.

*Added in version 0.2.3.*
"""

uom_id: Annotated[int, ModelRef("uom_id", Uom)]
"""The ID for the Unit of Measure for this product."""

Expand Down Expand Up @@ -366,4 +388,5 @@ def get_sellable_company_product_by_name(
# NOTE(callumdickinson): Import here to make sure circular imports work.
from .company import Company # noqa: E402
from .product_category import ProductCategory # noqa: E402
from .tax import Tax # noqa: E402
from .uom import Uom # noqa: E402