diff --git a/conf/16.src b/conf/16.src index 1985c19..ecb7dae 100644 --- a/conf/16.src +++ b/conf/16.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/f5ffcf7feec5526a483f8ddd240648c084351008.tar.gz -SOURCE_SUM=f9d257058bb7075c2f0b75022fb2ec363ddeed27e3f1a55110ed08dfbee2227b +SOURCE_URL=https://github.com/odoo/odoo/archive/2a88076c1d1df4920bfd139c94862a894d8ef3bc.tar.gz +SOURCE_SUM=39d23f01d9a095d75460829acfd53b74bcfc273a074d6eae163eedcaeeeb58c7 SOURCE_FILENAME=odoo-16.tar.gz SOURCE_FORMAT=tar.gz SOURCE_SUM_PRG=sha256sum diff --git a/conf/oca-16.src b/conf/oca-16.src index b8d1ef4..f327da3 100644 --- a/conf/oca-16.src +++ b/conf/oca-16.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/f5ffcf7feec5526a483f8ddd240648c084351008.tar.gz -SOURCE_SUM=bf972341c69e5f720162f3d9fa8a93d08ddb9f018c8aea5c4f5d7915c4275c5c +SOURCE_URL=https://github.com/OCA/OCB/archive/9d5ff52da5ec65a21a00a46e21783a2c6188dd80.tar.gz +SOURCE_SUM=3c3a95ec627e3807c85b0b2fd13a484b0b990426efb4905681aaee8768386e39 SOURCE_FILENAME=oca-16.tar.gz SOURCE_FORMAT=tar.gz SOURCE_SUM_PRG=sha256sum diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..72b559c --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,36 @@ +version = "1.0" + +[custom_code] +name = "Manage custom code" + + [custom_code.components] + + [custom_code.components.custom_repo] + ask = "Fill in your custom repo" + type = "url" + bind = "null" + help = """\ + It is expected to contain one or more addons, and possibly a [repos.yml](https://github.com/acsone/git-aggregator#configuration-file) and/or a [requirements.txt](https://pip.pypa.io/en/stable/reference/requirements-file-format) which will be installed for this instance when you click 'Update custom code' below.\ + """ + + [custom_code.components.custom_branch] + ask = "Fill in the branch to use" + type = "string" + help = "You should use the repo's main branch for your production instance, and some other branch for testing that you regularly merge into the main branch. Leave empty if unsure" + bind = "null" + visible = "custom_repo" + + [custom_code.components.update_code] + ask = "Update custom code" + type = "button" + help = "This will pull your custom code, run gitaggregate if there's a repos.yml file, install/update requirements.txt, and run a database update if you have the [module_auto_update](https://apps.odoo.com/apps/modules/15.0/module_auto_update) module available" + +[config_file] +name = "Edit the odoo config file" +services = ["__APP__"] + + [config_file.components] + + [config_file.components.config_file] + type = "text" + bind = "/etc/__APP__/main.conf" diff --git a/manifest.json b/manifest.json index fd53710..c9e43f7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,14 @@ "en": "Suite of business apps (ERP: CRM, Accounting, Point of Sale, HR, Purchases...)", "fr": "Une collection d'apps de gestion d'entreprise (ERP : CRM, Comptabilité, Point de Vente, RH, Achats...)" }, - "version": "16.0~ynh1", + "version": "16.0~ynh2", "url": "https://odoo.com", "upstream": { "license": "LGPL-3.0-only", "website": "https://odoo.com", "demo": "https://www.odoo.com/trial", - "admindoc": "https://www.odoo.com/documentation/15.0/administration.html", - "userdoc": "https://www.odoo.com/documentation/15.0/applications.html", + "admindoc": "https://www.odoo.com/documentation/16.0/administration.html", + "userdoc": "https://www.odoo.com/documentation/16.0/applications.html", "code": "https://github.com/odoo/odoo" }, "license": "LGPL-3.0-only", @@ -52,8 +52,8 @@ "type": "boolean", "default": false, "ask": { - "en": "Do you want to setup OCA instead of LibreERP? (not yet implemented)", - "fr": "Désirez vous installer OCA à la place des sources de LibreERP (pas encore implémenté)" + "en": "Do you want to setup OCA instead of LibreERP?", + "fr": "Désirez vous installer OCA à la place des sources de LibreERP" } }, { diff --git a/scripts/config b/scripts/config new file mode 100755 index 0000000..92659f2 --- /dev/null +++ b/scripts/config @@ -0,0 +1,102 @@ +#!/bin/bash +source /usr/share/yunohost/helpers +ynh_abort_if_errors + +CUSTOM_ADDONS=$final_path/custom-addons +VENV=$final_path/venv +CUSTOM_REPO=$CUSTOM_ADDONS/custom-repo +REPOS_YML=$CUSTOM_REPO/repos.yml +REQUIREMENTS_TXT=$CUSTOM_REPO/requirements.txt + +_setup_git() { + pushd $CUSTOM_ADDONS>/dev/null + ynh_exec_as $app git config --global user.email $app@$(hostname) + ynh_exec_as $app git config --global user.name $app + ynh_exec_as $app git config --global init.defaultBranch main + ynh_exec_as $app git config --global pull.rebase false + popd>/dev/null +} + +get__custom_repo() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + echo '"'$(ynh_exec_as $app git -C $CUSTOM_REPO remote get-url origin)'"' + fi +} + +get__custom_branch() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + echo '"'$(ynh_exec_as $app git -C $CUSTOM_REPO rev-parse --abbrev-ref HEAD)'"' + fi +} + +run__update_code() { + _setup_git + if [ -d $CUSTOM_REPO ]; then + ynh_script_progression --message="Updating custom code" + if [ -z "$custom_repo" ]; then + rm -rf $CUSTOM_REPO + else + pushd $CUSTOM_REPO + if [ ! -z "$custom_branch" ]; then + ynh_exec_as $app git -C $CUSTOM_REPO fetch origin $custom_branch + ynh_exec_as $app git -C $CUSTOM_REPO checkout $custom_branch + fi + ynh_exec_as $app git -C $CUSTOM_REPO reset --hard + ynh_exec_as $app git -C $CUSTOM_REPO pull -X theirs + popd + fi + else + ynh_script_progression --message="Installing custom code from $custom_repo" + pushd $CUSTOM_ADDONS + if [ ! -z "$custom_repo" ]; then + if [ ! -z "$custom_branch" ]; then + CUSTOM_BRANCH="-b $custom_branch" + else + CUSTOM_BRANCH="" + fi + ynh_exec_as $app git clone $custom_repo $CUSTOM_REPO $CUSTOM_BRANCH + fi + popd + fi + if [ ! -f "$REPOS_YML" ]; then + ynh_print_warn --message="Could not find a repos.yml file in $CUSTOM_REPO" + else + ynh_script_progression --message="Resetting repos and running gitaggregate" + pushd $CUSTOM_ADDONS + for GITDIR in $(find $CUSTOM_ADDONS -name .git); do + ynh_exec_as $app git -C $(dirname $GITDIR) reset --hard + done + ynh_exec_as $app $VENV/bin/pip3 install -U git-aggregator + ynh_exec_as $app $VENV/bin/gitaggregate --force --no-color -c $REPOS_YML + popd + fi + pushd $CUSTOM_ADDONS + # link addons to custom-addons + for MANIFEST in $(find $CUSTOM_ADDONS -name __manifest__.py); do + ynh_exec_as $app ln -rsnf $(dirname $MANIFEST) + done + find $CUSTOM_ADDONS -maxdepth 1 -xtype l -delete + popd + if [ -f $REQUIREMENTS_TXT ]; then + ynh_exec_as $app $VENV/bin/pip3 install -Ur $CUSTOM_REPO/requirements.txt + fi + ynh_script_progression --message="Updating odoo addons and restarting the service" + sudo -u $app $VENV/bin/python $final_path/libreerp/odoo-bin shell -d $app -c /etc/$app/main.conf --logfile /proc/self/fd/1 <