[FIX] new project missing odoo_conf

This commit is contained in:
Mathieu Benoit 2023-12-02 14:13:18 -05:00
parent addb636042
commit 5f7090489e
2 changed files with 11 additions and 3 deletions

View file

@ -57,6 +57,11 @@ def get_config():
required=True, required=True,
help="Module name to create", help="Module name to create",
) )
parser.add_argument(
"--odoo_config",
default="./config.conf",
help="Odoo config path",
)
parser.add_argument( parser.add_argument(
"--config", "--config",
help="""Configuration to create models with fields and type. JSON style. help="""Configuration to create models with fields and type. JSON style.
@ -116,12 +121,14 @@ class ProjectManagement:
keep_bd_alive=False, keep_bd_alive=False,
coverage=False, coverage=False,
config="", config="",
odoo_config="./config.conf",
): ):
self.force = force self.force = force
self._coverage = coverage self._coverage = coverage
self.keep_bd_alive = keep_bd_alive self.keep_bd_alive = keep_bd_alive
self.msg_error = "" self.msg_error = ""
self.has_config_update = False self.has_config_update = False
self.odoo_config = odoo_config
self.module_directory = module_directory self.module_directory = module_directory
if not os.path.exists(self.module_directory): if not os.path.exists(self.module_directory):
@ -522,7 +529,7 @@ class ProjectManagement:
os.system(cmd) os.system(cmd)
# Validate # Validate
if not os.path.exists(template_path): if not os.path.exists(module_path):
_logger.error(f"Module not exists '{module_path}'") _logger.error(f"Module not exists '{module_path}'")
return False return False
else: else:
@ -532,7 +539,7 @@ class ProjectManagement:
def update_config(self): def update_config(self):
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read("./config.conf") config.read(self.odoo_config)
addons_path = config.get("options", "addons_path") addons_path = config.get("options", "addons_path")
lst_addons_path = addons_path.split(",") lst_addons_path = addons_path.split(",")
lst_directory = list( lst_directory = list(
@ -579,6 +586,7 @@ def main():
keep_bd_alive=config.keep_bd_alive, keep_bd_alive=config.keep_bd_alive,
coverage=config.coverage, coverage=config.coverage,
config=config.config, config=config.config,
odoo_config=config.odoo_config,
) )
if project.msg_error: if project.msg_error:
return -1 return -1

View file

@ -8,7 +8,7 @@
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose &
DAEMON_PID=$! DAEMON_PID=$!
./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_DEV} ./.venv/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${EL_MANIFEST_DEV} "$@"
./.venv/repo sync -v --force-sync -m ${EL_MANIFEST_DEV} ./.venv/repo sync -v --force-sync -m ${EL_MANIFEST_DEV}
kill ${DAEMON_PID} kill ${DAEMON_PID}