diff --git a/Makefile b/Makefile index 316951e07..ffdccde70 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ VERSION := community ADDONS=${PWD}/addons,${PWD}/odoo/addons,${PWD}/extra-addons BACKUP=${CDN}/raw/branch/main/backup/${VERSION}/odoo18-main_2025-01-15_08-05-47.zip AUTOMATION_PATH=${PWD}/automation +UPGRADE_SCRIPTS=$(shell cat upgrade_scripts | tr '\n' ',') ##### Virtual Environment ##### check-virtualenv: @if [ "$(VENV)" = "missing" ]; then \ @@ -69,7 +70,10 @@ scaffold_module: install_modules: ${PYTHON} odoo-bin --config=${CONFIG} -d ${DATABASE} -i ${MODULES} --xmlrpc-port=${PORT} upgrade_modules: - ${PYTHON} odoo-bin upgrade_code --script ${SCRIPTS} --addons-path=${UPGRADE_DIR} || true + @for script in $$(cat upgrade_scripts); do \ + echo "Running upgrade script: $$script"; \ + ${PYTHON} odoo-bin upgrade_code --script $$script --addons-path=${UPGRADE_DIR} || true; \ + done delete_records: ${PYTHON} ${SCRIPT_PATH}/delete_records.py ${DATABASE} ${BASE_MODEL} --force drop_database: diff --git a/extra-addons b/extra-addons index 1c5e4323e..026d565b5 160000 --- a/extra-addons +++ b/extra-addons @@ -1 +1 @@ -Subproject commit 1c5e4323ebe5831ab45cca8d2a82602453d0f43c +Subproject commit 026d565b5e97acf731a94851f04e522f893b7a9d diff --git a/odoo/upgrade_code/17.5-01-tree-to-list.py b/odoo/upgrade_code/17.5-01-tree-to-list.py old mode 100644 new mode 100755 diff --git a/odoo/upgrade_code/17.5-02-replace-attrs.py b/odoo/upgrade_code/17.5-02-replace-attrs.py index 0cd94ebcb..a7031e2e1 100644 --- a/odoo/upgrade_code/17.5-02-replace-attrs.py +++ b/odoo/upgrade_code/17.5-02-replace-attrs.py @@ -85,13 +85,22 @@ def upgrade(file_manager): def get_new_attrs(attrs): try: - # Use ast.literal_eval for safe evaluation of Python literals + # First check if this looks like a JavaScript expression + if any(js_indicator in attrs for js_indicator in ['=>', '?', ':', 'function', 'this.', 'get', 'set']): + # This is a JavaScript expression, preserve it as-is + return {'attrs': attrs.strip()} + + # Try parsing as Python literal attrs_dict = literal_eval(attrs.strip()) if not isinstance(attrs_dict, dict): logger.warning(f"Invalid attrs format, expected dict, got {attrs_dict}") return {} return {attr: stringify_attr(attrs_dict[attr]) for attr in NEW_ATTRS if attr in attrs_dict} except (ValueError, SyntaxError) as e: + # If parsing fails, check if it's a simple JavaScript object + if attrs.strip().startswith('{') and attrs.strip().endswith('}'): + # Preserve simple JavaScript object as-is + return {'attrs': attrs.strip()} logger.error(f"Failed to parse attrs '{attrs}': {e}") return {} except Exception as e: @@ -123,9 +132,14 @@ def upgrade(file_manager): for tag in tags_with_attrs: new_attrs = get_new_attrs(tag['attrs']) if new_attrs: # Only proceed if parsing succeeded - del tag['attrs'] - for attr, value in new_attrs.items(): - tag[attr] = value + if 'attrs' in new_attrs: + # This is a JavaScript expression, preserve it + tag['attrs'] = new_attrs['attrs'] + else: + # This is a Python literal that was parsed + del tag['attrs'] + for attr, value in new_attrs.items(): + tag[attr] = value else: logger.warning(f"Skipping tag in {file.path} due to invalid attrs: {tag.get('attrs')}") @@ -133,11 +147,16 @@ def upgrade(file_manager): for attr_tag in attr_tags: new_attrs = get_new_attrs(attr_tag.text) if new_attrs: - for attr, value in new_attrs.items(): - new_tag = soup.new_tag('attribute', name=attr) - new_tag.string = value - attr_tag.insert_after(new_tag) - attr_tag.decompose() + if 'attrs' in new_attrs: + # This is a JavaScript expression, preserve it + attr_tag.string = new_attrs['attrs'] + else: + # This is a Python literal that was parsed + for attr, value in new_attrs.items(): + new_tag = soup.new_tag('attribute', name=attr) + new_tag.string = value + attr_tag.insert_after(new_tag) + attr_tag.decompose() else: logger.warning(f"Skipping attribute tag in {file.path} due to invalid attrs: {attr_tag.text}") diff --git a/protected.txt b/protected.txt index 51254e723..60ae606e5 100644 --- a/protected.txt +++ b/protected.txt @@ -6,4 +6,6 @@ odoo/* requirements.txt Dockerfile automation -*.yaml \ No newline at end of file +*.yaml +FTACPA +FTACPA/* \ No newline at end of file diff --git a/upgrade_scripts b/upgrade_scripts new file mode 100644 index 000000000..c25d34f74 --- /dev/null +++ b/upgrade_scripts @@ -0,0 +1,5 @@ +17.5-01-tree-to-list +17.5-02-replace-attrs +17.5-03-replace-chatter +17.5-04-ir-cron +17.5-05-jsonrpc-to-rpc \ No newline at end of file diff --git a/utility b/utility index e541836cf..97bd3a1c8 160000 --- a/utility +++ b/utility @@ -1 +1 @@ -Subproject commit e541836cfc777b5cfddd876b5df89bdce0d07562 +Subproject commit 97bd3a1c88679d2c6d390f6f2f33cc6ecc57dfed