Merge branch 'develop'

- support private makefile and csv pycharm importation
- add default module installation suggested by OCA
This commit is contained in:
Mathieu Benoit 2025-06-01 14:19:30 -04:00
commit 00976d766e
4 changed files with 160 additions and 111 deletions

View file

@ -42,7 +42,7 @@ endif
-include ./conf/make.todo.Makefile
# Include private Makefile
-include make.private.Makefile
-include ./conf/make.private.Makefile
# Example for update
.PHONY: custom_run_example

View file

@ -439,7 +439,20 @@
"mail_debrand",
"remove_odoo_enterprise",
"web_responsive",
"web_timeline"
"web_timeline",
"server_action_mass_edit",
"base_name_search_improved",
"partner_firstname",
"web_search_with_and",
"web_listview_range_select",
"web_dialog_size",
"password_security",
"web_refresher",
"date_range",
"partner_contact_access_link",
"auditlog",
"queue_job",
"web_advanced_search"
]
}
]
@ -456,6 +469,17 @@
}
]
},
"odoo16.0_invoice_qc_ca": {
"base": "odoo16.0_base",
"disable": false,
"image_list": [
{
"module": [
"partner_manual_rank"
]
}
]
},
"odoo16.0_website_crm": {
"base": "odoo16.0_website",
"disable": false,
@ -482,7 +506,8 @@
{
"module": [
"l10n_ca",
"website_sale"
"website_sale",
"partner_manual_rank"
]
}
]
@ -500,7 +525,20 @@
"mail_debrand",
"remove_odoo_enterprise",
"web_responsive",
"web_timeline"
"web_timeline",
"server_action_mass_edit",
"base_name_search_improved",
"partner_firstname",
"web_search_with_and",
"web_listview_range_select",
"web_dialog_size",
"password_security",
"web_refresher",
"date_range",
"partner_contact_access_link",
"auditlog",
"queue_job",
"web_advanced_search"
]
}
]
@ -516,7 +554,8 @@
"mrp",
"purchase_mrp",
"hr_payroll_community",
"sale_mrp"
"sale_mrp",
"partner_manual_rank"
]
}
]
@ -554,6 +593,7 @@
"om_account_asset",
"om_account_budget",
"partner_statement",
"partner_manual_rank",
"payment",
"plm",
"portal",

View file

@ -258,11 +258,11 @@ class GitTool:
"""
lst_filter_group = filter_group.split(",") if filter_group else []
manifest_file = self.get_manifest_file(repo_path=repo_path)
if manifest_file.startswith("/home/"):
if os.path.isabs(manifest_file):
# This is a absolute path
filename = manifest_file
else:
filename = f"{repo_path}{manifest_file}"
filename = os.path.normpath(os.path.join(repo_path, manifest_file))
lst_repo = []
with open(filename) as xml:
xml_as_string = xml.read()

View file

@ -9,6 +9,7 @@ import logging
import os
import subprocess
import sys
import io
import xmltodict
@ -31,6 +32,9 @@ VCS_WORKSPACE = os.path.join(IDEA_PATH, "vcs.xml")
PATH_EXCLUDE_FOLDER = "./conf/pycharm_exclude_folder.txt"
PATH_DEFAULT_CONFIGURATION = "./conf/pycharm_default_configuration.csv"
PATH_DEFAULT_CONFIGURATION_PRIVATE = (
"./conf/pycharm_default_configuration.private.csv"
)
def get_config():
@ -315,111 +319,116 @@ def add_configuration(dct_xml, file_name, config):
_logger.error(f"Cannot read file '{PATH_DEFAULT_CONFIGURATION}'")
return has_change
with open(PATH_DEFAULT_CONFIGURATION) as txt:
for default_conf in csv.DictReader(txt):
conf_name = default_conf.get("name")
conf_folder = default_conf.get("folder")
conf_script_path = default_conf.get("script_path")
conf_default = bool(default_conf.get("default"))
if conf_default:
last_default = f"Python.{conf_name}"
conf_script_path_replace = (
conf_script_path
if not conf_script_path.startswith("./")
else f"$PROJECT_DIR${conf_script_path[1:]}"
)
conf_parameter = default_conf.get("parameters")
s_unique_key = (
f"d {conf_folder} s {conf_script_path} p {conf_parameter}"
)
if (
config.overwrite
or s_unique_key not in lst_unique_configuration
):
# add it!
if not config.overwrite and conf_name in lst_configuration:
_logger.error(
f"Cannot add configuration name '{conf_name}',"
" already exist. Delete it manually."
)
else:
has_change = True
lst_xml_configuration_name.append(
{"@itemvalue": f"Python.{conf_name}"}
)
conf_full = {
"@name": conf_name,
"@type": "PythonConfigurationType",
"@factoryName": "Python",
"module": {"@name": PROJECT_NAME},
"option": [
{
"@name": "INTERPRETER_OPTIONS",
"@value": "",
},
{"@name": "PARENT_ENVS", "@value": "true"},
{
"@name": "SDK_HOME",
"@value": "$PROJECT_DIR$/.venv/bin/python",
},
{
"@name": "WORKING_DIRECTORY",
"@value": "$PROJECT_DIR$",
},
{
"@name": "IS_MODULE_SDK",
"@value": "false",
},
{
"@name": "ADD_CONTENT_ROOTS",
"@value": "true",
},
{
"@name": "ADD_SOURCE_ROOTS",
"@value": "true",
},
{
"@name": "SCRIPT_NAME",
"@value": conf_script_path_replace,
},
{
"@name": "PARAMETERS",
"@value": conf_parameter,
},
{
"@name": "SHOW_COMMAND_LINE",
"@value": "false",
},
{
"@name": "EMULATE_TERMINAL",
"@value": "false",
},
{
"@name": "MODULE_MODE",
"@value": "false",
},
{
"@name": "REDIRECT_INPUT",
"@value": "false",
},
{"@name": "INPUT_FILE", "@value": ""},
],
"envs": {
"env": {
"@name": "PYTHONUNBUFFERED",
"@value": "1",
}
},
"EXTENSION": {
"@ID": "PythonCoverageRunConfigurationExtension",
"@runner": "coverage.py",
},
"method": {"@v": "2"},
}
if conf_folder:
conf_full["@folderName"] = conf_folder
lst_configuration_full.insert(0, conf_full)
content1 = txt.read()
if os.path.isfile(PATH_DEFAULT_CONFIGURATION_PRIVATE):
with open(PATH_DEFAULT_CONFIGURATION_PRIVATE) as txt:
content2 = txt.read()
merged_content = content1 + content2
else:
merged_content = content1
txt_merged = io.StringIO(merged_content)
for default_conf in csv.DictReader(txt_merged):
conf_name = default_conf.get("name")
conf_folder = default_conf.get("folder")
conf_script_path = default_conf.get("script_path")
conf_default = bool(default_conf.get("default"))
if conf_default:
last_default = f"Python.{conf_name}"
conf_script_path_replace = (
conf_script_path
if not conf_script_path.startswith("./")
else f"$PROJECT_DIR${conf_script_path[1:]}"
)
conf_parameter = default_conf.get("parameters")
s_unique_key = (
f"d {conf_folder} s {conf_script_path} p {conf_parameter}"
)
if config.overwrite or s_unique_key not in lst_unique_configuration:
# add it!
if not config.overwrite and conf_name in lst_configuration:
_logger.error(
f"Cannot add configuration name '{conf_name}',"
" already exist. Delete it manually."
)
else:
_logger.info(f"Configuration already exist: '{s_unique_key}'")
has_change = True
lst_xml_configuration_name.append(
{"@itemvalue": f"Python.{conf_name}"}
)
conf_full = {
"@name": conf_name,
"@type": "PythonConfigurationType",
"@factoryName": "Python",
"module": {"@name": PROJECT_NAME},
"option": [
{
"@name": "INTERPRETER_OPTIONS",
"@value": "",
},
{"@name": "PARENT_ENVS", "@value": "true"},
{
"@name": "SDK_HOME",
"@value": "$PROJECT_DIR$/.venv/bin/python",
},
{
"@name": "WORKING_DIRECTORY",
"@value": "$PROJECT_DIR$",
},
{
"@name": "IS_MODULE_SDK",
"@value": "false",
},
{
"@name": "ADD_CONTENT_ROOTS",
"@value": "true",
},
{
"@name": "ADD_SOURCE_ROOTS",
"@value": "true",
},
{
"@name": "SCRIPT_NAME",
"@value": conf_script_path_replace,
},
{
"@name": "PARAMETERS",
"@value": conf_parameter,
},
{
"@name": "SHOW_COMMAND_LINE",
"@value": "false",
},
{
"@name": "EMULATE_TERMINAL",
"@value": "false",
},
{
"@name": "MODULE_MODE",
"@value": "false",
},
{
"@name": "REDIRECT_INPUT",
"@value": "false",
},
{"@name": "INPUT_FILE", "@value": ""},
],
"envs": {
"env": {
"@name": "PYTHONUNBUFFERED",
"@value": "1",
}
},
"EXTENSION": {
"@ID": "PythonCoverageRunConfigurationExtension",
"@runner": "coverage.py",
},
"method": {"@v": "2"},
}
if conf_folder:
conf_full["@folderName"] = conf_folder
lst_configuration_full.insert(0, conf_full)
else:
_logger.info(f"Configuration already exist: '{s_unique_key}'")
if last_default:
dct_component["@selected"] = last_default