|
| 1 | +====================================================== |
| 2 | +Generate XML IDs for Product Template Attribute Values |
| 3 | +====================================================== |
| 4 | + |
| 5 | +.. |
| 6 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 7 | + !! This file is generated by oca-gen-addon-readme !! |
| 8 | + !! changes will be overwritten. !! |
| 9 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 10 | + !! source digest: sha256:fdec833460da026c1c5e41298152df57ef0efcbb741b5718a833b6d1e4b4ad35 |
| 11 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 12 | +
|
| 13 | +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png |
| 14 | + :target: https://odoo-community.org/page/development-status |
| 15 | + :alt: Beta |
| 16 | +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png |
| 17 | + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html |
| 18 | + :alt: License: LGPL-3 |
| 19 | +.. |badge3| image:: https://img.shields.io/badge/github-OdooDataFlow%2Faddons-lightgray.png?logo=github |
| 20 | + :target: https://github.com/OdooDataFlow/addons/tree/18.0/product_template_attribute_value_xmlid |
| 21 | + :alt: OdooDataFlow/addons |
| 22 | + |
| 23 | +|badge1| |badge2| |badge3| |
| 24 | + |
| 25 | +This Odoo module automates the generation of XML IDs for |
| 26 | +product.template.attribute.value records. These records define the |
| 27 | +specific combinations of attributes and their values used to create |
| 28 | +product variants (e.g., "Color: Red, Size: Large"). |
| 29 | + |
| 30 | +Functionality: |
| 31 | +-------------- |
| 32 | + |
| 33 | +Automatic XML ID Generation: |
| 34 | + |
| 35 | +The module overrides the create() method of the |
| 36 | +product.template.attribute.value model. Whenever a new |
| 37 | +product.template.attribute.value record is created, the module |
| 38 | +automatically generates an XML ID for it. XML ID Naming Convention: |
| 39 | + |
| 40 | +The generated XML ID follows a predefined pattern, composed of the XML |
| 41 | +IDs of the related records: prod_templ_id.xmlid: The XML ID of the |
| 42 | +associated product.template. attribute_id.xmlid: The XML ID of the |
| 43 | +associated product.attribute. attribute_value_id.xmlid: The XML ID of |
| 44 | +the associated product.attribute.value. |
| 45 | + |
| 46 | +The parts are combined with underscorese. This ensures that the XML ID |
| 47 | +is predictable and reflects the specific attribute value combination. |
| 48 | + |
| 49 | +Manual XML ID Generation: |
| 50 | +------------------------- |
| 51 | + |
| 52 | +The module also provides a method (generate_attribute_value_xmlids) that |
| 53 | +can be manually triggered to generate XML IDs for existing |
| 54 | +product.template.attribute.value records that might not have them. |
| 55 | +Benefits: |
| 56 | + |
| 57 | +Predictability: Ensures consistent and predictable XML IDs. Automation: |
| 58 | +Automates the XML ID creation process. Data Integrity: Maintains data |
| 59 | +integrity by generating unique XML IDs. Integration: Simplifies |
| 60 | +integration with external systems. |
| 61 | + |
| 62 | +**Table of contents** |
| 63 | + |
| 64 | +.. contents:: |
| 65 | + :local: |
| 66 | + |
| 67 | +Use Cases / Context |
| 68 | +=================== |
| 69 | + |
| 70 | +Purpose: |
| 71 | +-------- |
| 72 | + |
| 73 | +The module ensures that every product.template.attribute.value record |
| 74 | +has a predictable and consistent XML ID, which is crucial for: |
| 75 | + |
| 76 | +Data Integration: Facilitating seamless data exchange with external |
| 77 | +systems that rely on stable identifiers. Automation: Simplifying |
| 78 | +automated processes within Odoo that need to reference specific |
| 79 | +attribute value combinations. |
| 80 | + |
| 81 | +Use Cases: |
| 82 | +---------- |
| 83 | + |
| 84 | +E-commerce platforms that need to synchronize product variant data with |
| 85 | +Odoo. Warehouse management systems that rely on unique identifiers for |
| 86 | +product configurations. Any scenario where stable and predictable |
| 87 | +identifiers for product attribute combinations are required. This |
| 88 | +description provides a good overview of the module's purpose and |
| 89 | +functionality. |
| 90 | + |
| 91 | +Installation |
| 92 | +============ |
| 93 | + |
| 94 | +[ This file must only be present if there are very specific installation |
| 95 | +instructions, such as installing non-python dependencies. The audience |
| 96 | +is systems administrators. ] |
| 97 | + |
| 98 | +Configuration |
| 99 | +============= |
| 100 | + |
| 101 | +To configure this module, you need to: |
| 102 | + |
| 103 | +1. Ensure that the ``product`` module is installed in your Odoo |
| 104 | + instance, as this module is a dependency. |
| 105 | +2. Place the ``product_template_attribute_value_xmlid`` module directory |
| 106 | + in your Odoo addons path. |
| 107 | +3. Install the ``product_template_attribute_value_xmlid`` module through |
| 108 | + the Odoo Apps interface. |
| 109 | + |
| 110 | +Usage |
| 111 | +===== |
| 112 | + |
| 113 | +Usage Guide: ``product_template_attribute_value_xmlid`` Module |
| 114 | +============================================================== |
| 115 | + |
| 116 | +This document provides instructions on how to use the |
| 117 | +``product_template_attribute_value_xmlid`` module in Odoo. |
| 118 | + |
| 119 | +Purpose |
| 120 | +------- |
| 121 | + |
| 122 | +The ``product_template_attribute_value_xmlid`` module automates the |
| 123 | +generation of XML IDs for ``product.template.attribute.value`` records, |
| 124 | +which represent specific combinations of product attributes and their |
| 125 | +values. This is crucial for data integration and automation purposes. |
| 126 | + |
| 127 | +Automatic XML ID Generation |
| 128 | +--------------------------- |
| 129 | + |
| 130 | +Once installed, the module automatically generates XML IDs for new |
| 131 | +``product.template.attribute.value`` records. You don't need to perform |
| 132 | +any manual steps for this. |
| 133 | + |
| 134 | +**Example:** |
| 135 | + |
| 136 | +When you create a new product template with attributes (e.g., Color: |
| 137 | +Red, Size: Large), the corresponding |
| 138 | +``product.template.attribute.value`` records created by Odoo will |
| 139 | +automatically receive XML IDs. |
| 140 | + |
| 141 | +Manual XML ID Generation (Optional) |
| 142 | +----------------------------------- |
| 143 | + |
| 144 | +In some cases, you might have existing |
| 145 | +``product.template.attribute.value`` records that were created before |
| 146 | +installing this module and therefore lack XML IDs. The module provides a |
| 147 | +method to generate XML IDs for these records. |
| 148 | + |
| 149 | +**Steps:** |
| 150 | + |
| 151 | +1. Navigate to the "Product Attribute Values" in the "Product" module. |
| 152 | +2. Open any form view of a ``product.template.attribute.value`` record. |
| 153 | +3. Click the "Generate XML IDs" button. |
| 154 | +4. Odoo will generate XML IDs for all |
| 155 | + ``product.template.attribute.value`` records that currently don't |
| 156 | + have them. |
| 157 | + |
| 158 | +XML ID Naming Convention |
| 159 | +------------------------ |
| 160 | + |
| 161 | +The generated XML IDs follow this pattern: |
| 162 | +prod_templ\_<product_template_xmlid>\ *attr*\ <attribute_xmlid>\ *val*\ <attribute_value_xmlid> |
| 163 | + |
| 164 | +**Example:** prod_templ_product_template_123_attr_color_val_red |
| 165 | + |
| 166 | +- ``prod_templ_``: Prefix indicating "product template." |
| 167 | +- ``<product_template_xmlid>``: The XML ID of the related |
| 168 | + ``product.template`` record. |
| 169 | +- ``attr_``: Prefix indicating "attribute." |
| 170 | +- ``<attribute_xmlid>``: The XML ID of the related |
| 171 | + ``product.attribute`` record. |
| 172 | +- ``val_``: Prefix indicating "attribute value." |
| 173 | +- ``<attribute_value_xmlid>``: The XML ID of the related |
| 174 | + ``product.attribute.value`` record. |
| 175 | + |
| 176 | +**Note:** |
| 177 | + |
| 178 | +- All parts of the XML ID are converted to lowercase. |
| 179 | +- Spaces are replaced with underscores. |
| 180 | + |
| 181 | +Important Considerations |
| 182 | +------------------------ |
| 183 | + |
| 184 | +- Ensure that the related ``product.template``, ``product.attribute``, |
| 185 | + and ``product.attribute.value`` records have XML IDs for the |
| 186 | + automatic generation to work correctly. |
| 187 | +- The module aims to generate unique XML IDs. However, if you have |
| 188 | + existing data with conflicting names or IDs, you might need to |
| 189 | + resolve those conflicts manually. |
| 190 | + |
| 191 | +Known issues / Roadmap |
| 192 | +====================== |
| 193 | + |
| 194 | +[ Enumerate known caveats and future potential improvements. It is |
| 195 | +mostly intended for end-users, and can also help potential new |
| 196 | +contributors discovering new features to implement. ] |
| 197 | + |
| 198 | +- This module might result in unpredictable behaviour when used with |
| 199 | + enterprise module ``product_barcodelookup``. |
| 200 | + |
| 201 | +Changelog |
| 202 | +========= |
| 203 | + |
| 204 | +[ The change log. The goal of this file is to help readers understand |
| 205 | +changes between version. The primary audience is end users and |
| 206 | +integrators. Purely technical changes such as code refactoring must not |
| 207 | +be mentioned here. |
| 208 | + |
| 209 | +This file may contain ONE level of section titles, underlined with the ~ |
| 210 | +(tilde) character. Other section markers are forbidden and will likely |
| 211 | +break the structure of the README.rst or other documents where this |
| 212 | +fragment is included. ] |
| 213 | + |
| 214 | +Bug Tracker |
| 215 | +=========== |
| 216 | + |
| 217 | +Bugs are tracked on `GitHub Issues <https://github.com/OdooDataFlow/addons/issues>`_. |
| 218 | +In case of trouble, please check there if your issue has already been reported. |
| 219 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 220 | +`feedback <https://github.com/OdooDataFlow/addons/issues/new?body=module:%20product_template_attribute_value_xmlid%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
| 221 | + |
| 222 | +Do not contact contributors directly about support or help with technical issues. |
| 223 | + |
| 224 | +Credits |
| 225 | +======= |
| 226 | + |
| 227 | +Authors |
| 228 | +------- |
| 229 | + |
| 230 | +* Odoo Data Flow |
| 231 | + |
| 232 | +Contributors |
| 233 | +------------ |
| 234 | + |
| 235 | +- bosd |
| 236 | + |
| 237 | +Other credits |
| 238 | +------------- |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | +Maintainers |
| 243 | +----------- |
| 244 | + |
| 245 | +This module is part of the `OdooDataFlow/addons <https://github.com/OdooDataFlow/addons/tree/18.0/product_template_attribute_value_xmlid>`_ project on GitHub. |
| 246 | + |
| 247 | +You are welcome to contribute. |
0 commit comments