### Field Swap Configuration Example Source: https://github.com/oca/server-ux/blob/18.0/chained_swapper/static/description/index.html Illustrates the configuration process for chained field swaps within Odoo. This involves defining a name, selecting the source model and starting field, and specifying chained field paths using dot notation to traverse relationships between models. ```Odoo Configuration Name for identifying it and use it for the action name. Select the source model where the swap will be started. Select the starting field for which the swap will be done. Add several chained fields. They are expressed as a string using dot notation, taking the source model as beginning for looking there the first field, and continuing from there drilling through. Example: picking_ids.partner_id for sale.order model will go to the linked deliveries orders, and change the customer there. ``` -------------------------------- ### Odoo Action and Menuitem for Partner Finder Source: https://github.com/oca/server-ux/blob/18.0/barcode_action/readme/USAGE.md Defines an Odoo window action (`res_partner_find`) to find partners by barcode and a menu item to access this functionality. The action context is configured to handle cases where the partner is not found. ```XML ``` -------------------------------- ### Odoo Wizard Form View and Action XML Configuration Source: https://github.com/oca/server-ux/blob/18.0/multi_step_wizard/README.rst Provides an example of an Odoo view definition for a multi-step wizard, inheriting from a base wizard view. It showcases how to conditionally display fields based on the wizard's state and defines an action to launch the wizard. ```xml my.wizard.form my.wizard primary

The project is now configured.

My Wizard my.wizard form new form
``` -------------------------------- ### Odoo Partner Search Logic Source: https://github.com/oca/server-ux/blob/18.0/barcode_action/readme/USAGE.md Implements the `find_res_partner_by_ref_using_barcode` method in Odoo's `res.partner` model. This method searches for a partner by a given barcode (external reference) and returns either the partner's form view or a message indicating the partner was not found. ```Python import json from odoo import api, models, _ from odoo.tools.safe_eval import safe_eval class ResPartner(models.Model): _inherit = 'res.partner' @api.multi def find_res_partner_by_ref_using_barcode(self, barcode): partner = self.search([('ref', '=', barcode)], limit=1) if not partner: action = self.env.ref('res_partner_find') result = action.read()[0] context = safe_eval(result['context']) context.update({ 'default_state': 'warning', 'default_status': _('Partner with Internal Reference ' '%s cannot be found') % barcode }) result['context'] = json.dumps(context) return result action = self.env.ref('base.action_partner_form') result = action.read()[0] res = self.env.ref('base.view_partner_form', False) result['views'] = [(res and res.id or False, 'form')] result['res_id'] = partner.id return result ``` -------------------------------- ### Contribution Guidelines Source: https://github.com/oca/server-ux/blob/18.0/template_content_swapper/static/description/index.html Information on how to contribute to the OCA/server-ux project, including a link to the general contribution page. ```markdown You are welcome to contribute. To learn how please visit [https://odoo-community.org/page/Contribute](https://odoo-community.org/page/Contribute). ``` -------------------------------- ### Bug Tracking and Contribution Guidelines Source: https://github.com/oca/server-ux/blob/18.0/multi_step_wizard/static/description/index.html Provides information on how to report bugs and contribute to the project. It directs users to GitHub Issues for bug tracking and outlines the process for contributing new features or fixes. ```markdown Bugs are tracked on [GitHub Issues](https://github.com/OCA/server-ux/issues). In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed [feedback](https://github.com/OCA/server-ux/issues/new?body=module:%20multi_step_wizard%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**). Do not contact contributors directly about support or help with technical issues. This module is part of the [OCA/server-ux](https://github.com/OCA/server-ux/tree/18.0/multi_step_wizard) project on GitHub. You are welcome to contribute. To learn how please visit [https://odoo-community.org/page/Contribute](https://odoo-community.org/page/Contribute). ``` -------------------------------- ### Python Constraint Example for Chained Swap Source: https://github.com/oca/server-ux/blob/18.0/chained_swapper/static/description/index.html An example Python expression used as a constraint to validate records before performing a chained swap. It checks if any related picking records have a 'done' state. Constraints are one-line Python expressions evaluated as boolean, using variables like 'records', 'env', 'date', and 'datetime'. If evaluation is true, a message is thrown, and the swap is disallowed. ```python any(p.state == ‘done’ for p in records.mapped(‘picking_ids.state’)) ``` -------------------------------- ### Odoo View Definition Source: https://github.com/oca/server-ux/blob/18.0/multi_step_wizard/static/description/index.html Defines a window action for opening a wizard in Odoo. This XML snippet specifies the action's name, target model, view mode, and binding to a specific project model. ```xml My Wizard my.wizard form new form ``` -------------------------------- ### Odoo Module Manifest Source: https://github.com/oca/server-ux/blob/18.0/developer_menu/README.rst The __manifest__.py file defines the module's metadata, including its name, version, author, category, dependencies, and data files. This is crucial for Odoo to recognize and install the module. ```Python { 'name': 'Developer Menu', 'version': '18.0.1.0.0', 'summary': 'Developer Menu', 'description': 'Because Technical menu is huge, this module adds a menu shortcut which gather main technical entries to help developers to save time.', 'category': 'Tools', 'author': 'Akretion', 'website': 'https://github.com/OCA/server-ux', 'license': 'AGPL-3', 'depends': [ 'base', ], 'data': [ 'views/developer_menu_views.xml', ], 'assets': { 'web.assets_backend': [ 'developer_menu/static/src/xml/assets.xml', ], }, 'installable': True, 'application': True, 'auto_install': False, } ``` -------------------------------- ### Module Structure and Configuration Source: https://github.com/oca/server-ux/blob/18.0/base_technical_features/README.rst This example outlines the typical structure of an Odoo module, including manifest files and data files, which are essential for its functionality and integration within the Odoo framework. ```XML Technical feature (w/o debug mode) Administrator admin ``` -------------------------------- ### Chained Swap Constraint Example Source: https://github.com/oca/server-ux/blob/18.0/chained_swapper/README.rst This Python expression serves as a constraint to restrict chained swaps. It evaluates to true if any of the linked 'picking_ids' records have a 'state' equal to 'done', preventing the swap and displaying an error message. ```python any(p.state == 'done' for p in records.mapped('picking_ids.state')) ``` -------------------------------- ### Python: Find Partner by Barcode Reference Source: https://github.com/oca/server-ux/blob/18.0/barcode_action/static/description/index.html Python code extending the `res.partner` model to implement a method that searches for a partner based on a barcode representing their external reference. If no partner is found, it prepares an action to display a warning. ```Python import json from odoo import api, models, _ from odoo.tools.safe_eval import safe_eval class ResPartner(models.Model): _inherit = 'res.partner' @api.multi def find_res_partner_by_ref_using_barcode(self, barcode): partner = self.search([('ref', '=', barcode)], limit=1) if not partner: action = self.env.ref('res_partner_find') result = action.read()[0] context = safe_eval(result['context']) context.update({ 'default_state': 'warning', ``` -------------------------------- ### Template Content Mapping Configuration Source: https://github.com/oca/server-ux/blob/18.0/template_content_swapper/static/description/index.html Defines the structure for mapping content to be replaced within QWeb templates. This configuration is managed through the Odoo backend interface. ```APIDOC Template Content Mapping Configuration: This configuration defines how content within QWeb templates can be dynamically replaced. Fields: - Report (optional): Specifies a Report record (e.g., 'account.report') that contains the string to be replaced. If set, it automatically updates the 'Template' field. - Template (required): The specific QWeb template (ir.ui.view record) where the content replacement should occur. - Language (optional): The target language code (e.g., 'en_US', 'fr_FR') for the replacement. If left blank, the replacement applies to all languages. - Content From (required): The existing string or content that needs to be replaced within the specified template. - Content To (optional): The new string or content that will replace 'Content From'. If empty, the 'Content From' will be removed. Usage Example: To replace 'Salesperson' with 'Sales Representative' in quotation reports: Report: Sales Order Template: sale.report_saleorder_document Content From: Salesperson Content To: Sales Representative To replace 'Add to Cart' with 'Add to Basket' on eCommerce product pages: Template: website_sale.product_card_product_variant Content From: Add to Cart Content To: Add to Basket ```