Last active
September 15, 2025 10:48
-
-
Save kwmiebach/2ca971042695d9986938a1f03e378ffa to your computer and use it in GitHub Desktop.
Available website settings and website fields in Odoo 18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Find out available website settings and website fields. | |
| The fields are recognized with a fuzzy algorythm, so there might be | |
| too many and some might be missing? | |
| Run this in an odoo shell of the odoo instance: | |
| ''' | |
| installed_langs = env['res.lang'].search([('active', '=', True)]) | |
| print("Installed languages:", installed_langs.mapped('code')) | |
| def find_webshop_settings_fields(): | |
| """ | |
| Find all available fields in res.config.settings related to website sale | |
| """ | |
| Settings = env['res.config.settings'] | |
| # Get all fields | |
| all_fields = Settings.fields_get() | |
| # Filter for website/sale related fields | |
| webshop_fields = {} | |
| keywords = ['website', 'sale', 'shop', 'cart', 'checkout', 'portal', | |
| 'newsletter', 'auth', 'signup', 'guest', 'buy'] | |
| for field_name, field_info in all_fields.items(): | |
| for keyword in keywords: | |
| if keyword in field_name.lower(): | |
| webshop_fields[field_name] = { | |
| 'type': field_info.get('type'), | |
| 'string': field_info.get('string'), | |
| 'help': field_info.get('help', ''), | |
| 'selection': field_info.get('selection', []) | |
| } | |
| break | |
| return webshop_fields | |
| # Print results | |
| print("\n=== Available Webshop Settings Fields ===\n") | |
| fields = find_webshop_settings_fields() | |
| for field, info in sorted(fields.items()): | |
| print(f"Field: {field}",end='') | |
| #print(f" Label: {info['string']}") | |
| #print(f" Type: {info['type']}") | |
| if info['selection']: | |
| print(f" Options: {info['selection']}") | |
| #if info['help']: | |
| # print(f" Help: {info['help'][:100]}...") | |
| else: | |
| print() | |
| print("\n=== Available Webshop Settings Fields ===\n") | |
| # Suppress all warnings and set translation logger to critical | |
| import warnings | |
| with warnings.catch_warnings(): | |
| warnings.simplefilter("ignore") | |
| import logging | |
| logging.getLogger('odoo.tools.translate').setLevel(logging.CRITICAL) | |
| # Now get your fields | |
| website_fields = env['website'].fields_get() | |
| import pprint | |
| pprint.pprint(sorted(list(website_fields.keys()))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment