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/25.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for fiscal positions
162 changes: 162 additions & 0 deletions docs/managers/fiscal-position-tax-mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Fiscal Position Tax Mappings

*Added in version 0.2.4.*

This page documents how to use the manager and record objects
for fiscal position tax mappings.

## Details

| Name | Value |
|-----------------|--------------------------------|
| Odoo Modules | Accounting |
| Odoo Model Name | `account.fiscal.position.tax` |
| Manager | `fiscal_position_tax_mappings` |
| Record Type | `FiscalPositionTaxMapping` |

## Manager

The fiscal position tax mapping manager is available as the `fiscal_position_tax_mappings`
attribute on the Odoo client object.

```python
>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
... hostname="localhost",
... port=8069,
... protocol="jsonrpc",
... database="odoodb",
... user="test-user",
... password="<password>",
... )
>>> odoo_client.fiscal_position_tax_mappings.get(1234)
FiscalPositionTaxMapping(record={'id': 1234, ...}, fields=None)
```

For more information on how to use managers, refer to [Managers](index.md).

## Record

The fiscal position tax mapping manager returns `FiscalPositionTaxMapping` record objects.

To import the record class for type hinting purposes:

```python
from openstack_odooclient import FiscalPositionTaxMapping
```

The record class currently implements the following fields and methods.

For more information on attributes and methods common to all record types,
see [Record Attributes and Methods](index.md#attributes-and-methods).

### `company_id`

```python
company_id: int
```

The ID for the [company](company.md) this fiscal position tax mapping
is associated with.

### `company_name`

```python
company_name: str
```

The name of the [company](company.md) this fiscal position tax mapping
is associated with.

### `company`

```python
company: Company
```

The [company](company.md) this fiscal position tax mapping
is associated with.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.

### `position_id`

```python
position_id: int
```

The ID for the [fiscal position](fiscal-position.md) this mapping is part of.

### `position_name`

```python
position_name: str
```

The name of the [fiscal position](fiscal-position.md) this mapping is part of.

### `position`

```python
position: FiscalPosition
```

The [fiscal position](fiscal-position.md) this mapping is part of.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.

### `tax_src_id`

```python
tax_src_id: int
```

The ID of the [tax](tax.md) to be overridden on products.

### `tax_src_name`

```python
tax_src_name: str
```

The name of the [tax](tax.md) to be overridden on products.

### `tax_src`

```python
tax_src: Tax
```

The [tax](tax.md) to be overridden on products.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.

### `tax_dest_id`

```python
tax_dest_id: int | None
```

The ID of the [tax](tax.md) to override the source tax with, if set.

### `tax_dest_name`

```python
tax_dest_name: str | None
```

The name of the [tax](tax.md) to override the source tax with, if set.

### `tax_dest`

```python
tax_dest: Tax | None
```

The [tax](tax.md) to override the source tax with, if set.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.
119 changes: 119 additions & 0 deletions docs/managers/fiscal-position.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Fiscal Positions

*Added in version 0.2.4.*

This page documents how to use the manager and record objects
for fiscal positions.

## Details

| Name | Value |
|-----------------|---------------------------|
| Odoo Modules | Accounting, Point of Sale |
| Odoo Model Name | `account.fiscal.position` |
| Manager | `fiscal_positions` |
| Record Type | `FiscalPosition` |

## Manager

The fiscal position manager is available as the `fiscal_positions`
attribute on the Odoo client object.

```python
>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
... hostname="localhost",
... port=8069,
... protocol="jsonrpc",
... database="odoodb",
... user="test-user",
... password="<password>",
... )
>>> odoo_client.fiscal_positions.get(1234)
FiscalPosition(record={'id': 1234, ...}, fields=None)
```

For more information on how to use managers, refer to [Managers](index.md).

## Record

The fiscal position manager returns `FiscalPosition` record objects.

To import the record class for type hinting purposes:

```python
from openstack_odooclient import FiscalPosition
```

The record class currently implements the following fields and methods.

For more information on attributes and methods common to all record types,
see [Record Attributes and Methods](index.md#attributes-and-methods).

### `active`

```python
active: bool
```

Whether or not this fiscal position is active (enabled).

### `company_id`

```python
company_id: int
```

The ID for the [company](company.md) this fiscal position is associated with.

### `company_name`

```python
company_name: str
```

The name of the [company](company.md) this fiscal position is associated with.

### `company`

```python
company: Company
```

The [company](company.md) this fiscal position is associated with.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.

### `name`

```python
name: str
```

The name of the fiscal position.

Not guaranteed to be unique.

### `tax_ids`

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

The list of IDs for the [tax mappings](fiscal-position-tax-mapping.md) that will be applied
to sale orders and invoices for partners using this
fiscal position.

### `taxes`

```python
taxes: list[FiscalPositionTaxMapping]
```

The list of [tax mappings](fiscal-position-tax-mapping.md) that will be applied
to sale orders and invoices for partners using this
fiscal position.

This fetches the full records from Odoo once,
and caches them for subsequent accesses.
33 changes: 33 additions & 0 deletions docs/managers/partner.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,39 @@ if it has a parent.
This fetches the full record from Odoo once,
and caches it for subsequent accesses.

### `property_account_position_id`

```python
property_account_position_id: int | None
```

The ID for the [fiscal position](fiscal-position.md) this partner uses, if it uses one.

*Added in version 0.2.4.*

### `property_account_position_name`

```python
property_account_position_name: str | None
```

The name of the [fiscal position](fiscal-position.md) this partner uses, if it uses one.

*Added in version 0.2.4.*

### `property_account_position`

```python
property_account_position: FiscalPosition | None
```

The [fiscal position](fiscal-position.md) this partner uses, if it uses one.

This fetches the full record from Odoo once,
and caches it for subsequent accesses.

*Added in version 0.2.4.*

### `property_product_pricelist_id`

```python
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ nav:
- managers/credit-transaction.md
- managers/currency.md
- managers/customer-group.md
- managers/fiscal-position.md
- managers/fiscal-position-tax-mapping.md
- managers/grant.md
- managers/grant-type.md
- managers/partner.md
Expand Down
9 changes: 9 additions & 0 deletions openstack_odooclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
from .managers.credit_type import CreditType, CreditTypeManager
from .managers.currency import Currency, CurrencyManager
from .managers.customer_group import CustomerGroup, CustomerGroupManager
from .managers.fiscal_position import FiscalPosition, FiscalPositionManager
from .managers.fiscal_position_tax_mapping import (
FiscalPositionTaxMapping,
FiscalPositionTaxMappingManager,
)
from .managers.grant import Grant, GrantManager
from .managers.grant_type import GrantType, GrantTypeManager
from .managers.partner import Partner, PartnerManager
Expand Down Expand Up @@ -108,6 +113,10 @@
"CustomerGroup",
"CustomerGroupManager",
"FieldAlias",
"FiscalPosition",
"FiscalPositionManager",
"FiscalPositionTaxMapping",
"FiscalPositionTaxMappingManager",
"Grant",
"GrantManager",
"GrantType",
Expand Down
10 changes: 10 additions & 0 deletions openstack_odooclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
from .managers.credit_type import CreditTypeManager
from .managers.currency import CurrencyManager
from .managers.customer_group import CustomerGroupManager
from .managers.fiscal_position import FiscalPositionManager
from .managers.fiscal_position_tax_mapping import (
FiscalPositionTaxMappingManager,
)
from .managers.grant import GrantManager
from .managers.grant_type import GrantTypeManager
from .managers.partner import PartnerManager
Expand Down Expand Up @@ -112,6 +116,12 @@ class Client(ClientBase):
customer_groups: CustomerGroupManager
"""OpenStack customer group manager."""

fiscal_positions: FiscalPositionManager
"""Fiscal position manager."""

fiscal_position_tax_mappings: FiscalPositionTaxMappingManager
"""Fiscal position tax mapping manager."""

grants: GrantManager
"""OpenStack grant manager."""

Expand Down
Loading