diff --git a/requirements.txt b/requirements.txt index 9cd1629223..f8e17c52c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ # generated from manifests external_dependencies +extendable_pydantic +pydantic diff --git a/setup/si_schema_address/odoo/addons/si_schema_address b/setup/si_schema_address/odoo/addons/si_schema_address new file mode 120000 index 0000000000..8e749e742a --- /dev/null +++ b/setup/si_schema_address/odoo/addons/si_schema_address @@ -0,0 +1 @@ +../../../../si_schema_address \ No newline at end of file diff --git a/setup/si_schema_address/setup.py b/setup/si_schema_address/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/si_schema_address/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopinvader_schema_address/__init__.py b/shopinvader_schema_address/__init__.py new file mode 100644 index 0000000000..cd83f25196 --- /dev/null +++ b/shopinvader_schema_address/__init__.py @@ -0,0 +1 @@ +from . import schema \ No newline at end of file diff --git a/shopinvader_schema_address/__manifest__.py b/shopinvader_schema_address/__manifest__.py new file mode 100644 index 0000000000..54375182ba --- /dev/null +++ b/shopinvader_schema_address/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + 'name': 'Shopinvader Schema Address', + 'summary': """ + Adds shchema address: address billing_address delivery_address""", + 'version': '16.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', + 'website': 'https://github.com/shopinvader/odoo-shopinvader', + "depends": [ + "pydantic", + "extendable", + ], + "external_dependencies": {"python": ["extendable_pydantic", "pydantic"]}, + 'data': [ + ], + 'demo': [ + ], + "installable": True, +} diff --git a/shopinvader_schema_address/readme/CONFIGURE.rst b/shopinvader_schema_address/readme/CONFIGURE.rst new file mode 100644 index 0000000000..754e51aeff --- /dev/null +++ b/shopinvader_schema_address/readme/CONFIGURE.rst @@ -0,0 +1,10 @@ +[ This file is optional, it should explain how to configure + the module before using it; it is aimed at advanced users. ] + +To configure this module, you need to: + +#. Go to ... + +.. figure:: ../static/description/image.png + :alt: alternative description + :width: 600 px diff --git a/shopinvader_schema_address/readme/CONTRIBUTORS.rst b/shopinvader_schema_address/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..786f0d6dc9 --- /dev/null +++ b/shopinvader_schema_address/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Firstname Lastname (optional company website url) +* Second Person (optional company website url) diff --git a/shopinvader_schema_address/readme/CREDITS.rst b/shopinvader_schema_address/readme/CREDITS.rst new file mode 100644 index 0000000000..505af5aae5 --- /dev/null +++ b/shopinvader_schema_address/readme/CREDITS.rst @@ -0,0 +1,7 @@ +[ This file is optional and contains additional credits, other than + authors, contributors, and maintainers. ] + +The development of this module has been financially supported by: + +* Company 1 name +* Company 2 name diff --git a/shopinvader_schema_address/readme/DESCRIPTION.rst b/shopinvader_schema_address/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..fc84a0ab1f --- /dev/null +++ b/shopinvader_schema_address/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +[ This file must be max 2-3 paragraphs, and is required. ] + +This module extends the functionality of ... to support ... +and to allow you to ... + diff --git a/shopinvader_schema_address/readme/HISTORY.rst b/shopinvader_schema_address/readme/HISTORY.rst new file mode 100644 index 0000000000..ac1f5b674c --- /dev/null +++ b/shopinvader_schema_address/readme/HISTORY.rst @@ -0,0 +1,24 @@ +[ The change log. The goal of this file is to help readers + understand changes between version. The primary audience is + end users and integrators. Purely technical changes such as + code refactoring must not be mentioned here. + + This file may contain ONE level of section titles, underlined + with the ~ (tilde) character. Other section markers are + forbidden and will likely break the structure of the README.rst + or other documents where this fragment is included. ] + +11.0.x.y.z (YYYY-MM-DD) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [BREAKING] Breaking changes come first. + (`#70 `_) +* [ADD] New feature. + (`#74 `_) +* [FIX] Correct this. + (`#71 `_) + +11.0.x.y.z (YYYY-MM-DD) +~~~~~~~~~~~~~~~~~~~~~~~ + +* ... diff --git a/shopinvader_schema_address/readme/INSTALL.rst b/shopinvader_schema_address/readme/INSTALL.rst new file mode 100644 index 0000000000..b62c6d1e95 --- /dev/null +++ b/shopinvader_schema_address/readme/INSTALL.rst @@ -0,0 +1,7 @@ +[ This file must only be present if there are very specific + installation instructions, such as installing non-python + dependencies. The audience is systems administrators. ] + +To install this module, you need to: + +#. Do this ... diff --git a/shopinvader_schema_address/readme/ROADMAP.rst b/shopinvader_schema_address/readme/ROADMAP.rst new file mode 100644 index 0000000000..207233013b --- /dev/null +++ b/shopinvader_schema_address/readme/ROADMAP.rst @@ -0,0 +1,5 @@ +[ Enumerate known caveats and future potential improvements. + It is mostly intended for end-users, and can also help + potential new contributors discovering new features to implement. ] + +* ... diff --git a/shopinvader_schema_address/readme/USAGE.rst b/shopinvader_schema_address/readme/USAGE.rst new file mode 100644 index 0000000000..f4629c3d54 --- /dev/null +++ b/shopinvader_schema_address/readme/USAGE.rst @@ -0,0 +1,11 @@ +[ This file must be present and contains the usage instructions + for end-users. As all other rst files included in the README, + it MUST NOT contain reStructuredText sections + only body text (paragraphs, lists, tables, etc). Should you need + a more elaborate structure to explain the addon, please create a + Sphinx documentation (which may include this file as a "quick start" + section). ] + +To use this module, you need to: + +#. Go to ... diff --git a/shopinvader_schema_address/schema/__init__.py b/shopinvader_schema_address/schema/__init__.py new file mode 100644 index 0000000000..974c6c7b12 --- /dev/null +++ b/shopinvader_schema_address/schema/__init__.py @@ -0,0 +1 @@ +from . import address diff --git a/shopinvader_schema_address/schema/address.py b/shopinvader_schema_address/schema/address.py new file mode 100644 index 0000000000..193a76b328 --- /dev/null +++ b/shopinvader_schema_address/schema/address.py @@ -0,0 +1,55 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import pydantic + +from typing import Optional + +from extendable_pydantic import ExtendableModelMeta +from pydantic import BaseModel +from odoo.addons.pydantic import utils + + +class State(BaseModel, metaclass=ExtendableModelMeta): + id: int + name: str + code: str + class Config: + orm_mode = True + getter_dict = utils.GenericOdooGetter + +class Country(BaseModel, metaclass=ExtendableModelMeta): + id: int + name: str + code: str + class Config: + orm_mode = True + getter_dict = utils.GenericOdooGetter + + +class Address(BaseModel, metaclass=ExtendableModelMeta): + name: str + street: str + street2: Optional[str] = None + zip: str + city: str + phone: Optional[str] = None + email: Optional[str] = None + state: Optional[State] = pydantic.Field(alias="state_id") or None + country: Country = pydantic.Field(alias="country_id") + + class Config: + orm_mode = True + getter_dict = utils.GenericOdooGetter + + +class BillingAddress(Address): + """ + Billing Address + """ + + +class ShippingAddress(Address): + """ + Shipping Address + """ diff --git a/shopinvader_schema_address/static/description/icon.png b/shopinvader_schema_address/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/shopinvader_schema_address/static/description/icon.png differ