|
| 1 | +# Copyright (C) 2026 Catalyst Cloud Limited |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | +# implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +from __future__ import annotations |
| 17 | + |
| 18 | +from typing import Annotated |
| 19 | + |
| 20 | +from ..base.record.base import RecordBase |
| 21 | +from ..base.record.types import ModelRef |
| 22 | +from ..base.record_manager.base import RecordManagerBase |
| 23 | + |
| 24 | + |
| 25 | +class FiscalPositionTaxMapping(RecordBase["FiscalPositionTaxMappingManager"]): |
| 26 | + company_id: Annotated[int, ModelRef("company_id", Company)] |
| 27 | + """The ID for the company this fiscal position tax mapping |
| 28 | + is associated with. |
| 29 | + """ |
| 30 | + |
| 31 | + company_name: Annotated[str, ModelRef("company_id", Company)] |
| 32 | + """The name of the company this fiscal position tax mapping |
| 33 | + is associated with. |
| 34 | + """ |
| 35 | + |
| 36 | + company: Annotated[Company, ModelRef("company_id", Company)] |
| 37 | + """The company this fiscal position tax mapping |
| 38 | + is associated with. |
| 39 | +
|
| 40 | + This fetches the full record from Odoo once, |
| 41 | + and caches it for subsequent accesses. |
| 42 | + """ |
| 43 | + |
| 44 | + position_id: Annotated[int, ModelRef("position_id", FiscalPosition)] |
| 45 | + """The ID for the fiscal position this mapping is part of.""" |
| 46 | + |
| 47 | + position_name: Annotated[str, ModelRef("position_id", FiscalPosition)] |
| 48 | + """The name of the fiscal position this mapping is part of.""" |
| 49 | + |
| 50 | + position: Annotated[ |
| 51 | + FiscalPosition, |
| 52 | + ModelRef("position_id", FiscalPosition), |
| 53 | + ] |
| 54 | + """The fiscal position this mapping is part of. |
| 55 | +
|
| 56 | + This fetches the full record from Odoo once, |
| 57 | + and caches it for subsequent accesses. |
| 58 | + """ |
| 59 | + |
| 60 | + tax_src_id: Annotated[int, ModelRef("tax_src_id", Tax)] |
| 61 | + """The ID of the tax to be overridden on products.""" |
| 62 | + |
| 63 | + tax_src_name: Annotated[str, ModelRef("tax_src_id", Tax)] |
| 64 | + """The name of the tax to be overridden on products.""" |
| 65 | + |
| 66 | + tax_src: Annotated[Tax, ModelRef("tax_src_id", Tax)] |
| 67 | + """The tax to be overridden on products. |
| 68 | +
|
| 69 | + This fetches the full records from Odoo once, |
| 70 | + and caches them for subsequent accesses. |
| 71 | + """ |
| 72 | + |
| 73 | + tax_dest_id: Annotated[int | None, ModelRef("tax_dest_id", Tax)] |
| 74 | + """The ID of the tax to be overridden on products.""" |
| 75 | + |
| 76 | + tax_dest_name: Annotated[str | None, ModelRef("tax_dest_id", Tax)] |
| 77 | + """The name of the tax to be overridden on products.""" |
| 78 | + |
| 79 | + tax_dest: Annotated[Tax | None, ModelRef("tax_dest_id", Tax)] |
| 80 | + """The tax to be overridden on products, if set. |
| 81 | +
|
| 82 | + This fetches the full records from Odoo once, |
| 83 | + and caches them for subsequent accesses. |
| 84 | + """ |
| 85 | + |
| 86 | + |
| 87 | +class FiscalPositionTaxMappingManager( |
| 88 | + RecordManagerBase[FiscalPositionTaxMapping], |
| 89 | +): |
| 90 | + env_name = "account.fiscal.position.tax" |
| 91 | + record_class = FiscalPositionTaxMapping |
| 92 | + |
| 93 | + |
| 94 | +# NOTE(callumdickinson): Import here to make sure circular imports work. |
| 95 | +from .company import Company # noqa: E402 |
| 96 | +from .fiscal_position import FiscalPosition # noqa: E402 |
| 97 | +from .tax import Tax # noqa: E402 |
0 commit comments