diff --git a/Makefile b/Makefile index 0e23508..2aed7e6 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,11 @@ install_dev: install_os: ./script/install_dev.sh +.PHONY: install_production +install_production: + ./script/install_dev.sh + ./script/install_production.sh + .PHONY: install_docker_debian install_docker_debian: ./script/ install_debian_10_prod_docker.sh @@ -180,27 +185,22 @@ image_db_create_erplibre_website: ./script/addons/install_addons.sh test hr ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos_hr +.PHONY: image_db_create_erplibre_code_generator +image_db_create_erplibre_code_generator: + ./script/make.sh addons_install_code_generator_basic + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database code_generator --restore_image erplibre_code_generator_basic + ./script/make.sh addons_install_code_generator_featured + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database code_generator --restore_image erplibre_code_generator_featured + ./script/make.sh addons_install_code_generator_full + ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database code_generator --restore_image erplibre_code_generator_full + .PHONY: image_db_create_all image_db_create_all: - ./script/make.sh db_create_db_test - ./script/addons/install_addons.sh test erplibre_base - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_base - ./script/addons/install_addons.sh test website,erplibre_website_snippets_basic_html,erplibre_website_snippets_cards,erplibre_website_snippets_structures,erplibre_website_snippets_timelines,website_form_builder - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website - ./script/addons/install_addons.sh test crm,website_crm - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_crm - ./script/addons/install_addons.sh test website_livechat - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_website_chat_crm - ./script/addons/install_addons.sh test website_sale,erplibre_base_quebec - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_base - ./script/addons/install_addons.sh test stock,purchase,website_sale_management - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_advance - ./script/addons/install_addons.sh test project - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_project - ./script/addons/install_addons.sh test pos_sale - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos - ./script/addons/install_addons.sh test hr - ./.venv/bin/python3 ./odoo/odoo-bin db --backup --database test --restore_image erplibre_ecommerce_pos_hr + #./script/make.sh config_gen_image_db + ./script/make.sh image_db_create_erplibre_base + ./script/make.sh image_db_create_erplibre_website + ./script/make.sh image_db_create_erplibre_code_generator + #./script/make.sh config_gen_all .PHONY: image_diff_base_website image_diff_base_website: @@ -476,6 +476,12 @@ config_gen_code_generator: ./script/git_repo_update_group.py --group base,code_generator ./script/install_locally.sh +# generate config repo image_db +.PHONY: config_gen_image_db +config_gen_image_db: + ./script/git_repo_update_group.py --group base,image_db + ./script/install_locally.sh + ########## # I18n # ########## diff --git a/README.md b/README.md index 747d535..14c5220 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # ERPLibre documentation -Select a guide to install your environment! +Select a guide to install your environment. ## Easy way to run locally -Clone the project +Clone the project: ```bash git clone https://github.com/ERPLibre/ERPLibre.git cd ERPLibre @@ -16,11 +16,22 @@ Update your configuration if you need to run from another interface than 127.0.0 #xmlrpc_interface = 127.0.0.1 #netrpc_interface = 127.0.0.1 ``` -Ready to execute +Ready to execute: ```bash make run ``` +## Easy way to run docker +First, install dependencies to run docker, check script `./script/install_ubuntu_docker.sh`. You need docker and docker-compose. + +The docker volume is binded to the directory name, therefore create a unique directory name and run: +```bash +wget https://raw.githubusercontent.com/ERPLibre/ERPLibre/v1.2.0/docker-compose.yml +docker-compose up -d +``` + +For more information, read [Docker guide](./docker/README.md). + ## Discover guide [Guide to run ERPLibre in discover to learn it](./doc/DISCOVER.md). diff --git a/default.xml b/default.xml index a483faf..b5de823 100644 --- a/default.xml +++ b/default.xml @@ -6,6 +6,7 @@ + @@ -22,6 +23,7 @@ + @@ -49,7 +51,7 @@ - + @@ -57,57 +59,59 @@ - + - - + + - - + + + - + - + - - + + - - - + + + + + - + - - + @@ -126,16 +130,17 @@ + - + - + - + @@ -143,9 +148,9 @@ - + - + diff --git a/doc/CODE_GENERATOR.base.md b/doc/CODE_GENERATOR.base.md index 95ea584..4e797d7 100644 --- a/doc/CODE_GENERATOR.base.md +++ b/doc/CODE_GENERATOR.base.md @@ -12,10 +12,10 @@ Never run this on production environment, this create circular dependencies and will cause frustration to clean damage. -Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendance circulaire pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. +Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. L'objectif du générateur de code est de : -- utilisation du générateur via l'interface web; +- utiliser le générateur via l'interface web; - créer un nouveau module; - modifier un module existant; - exécuter les tests. @@ -24,7 +24,7 @@ Ce générateur de code, pour ERPLibre, a tout avantage d'être sous licence AGP - (Utiliser) L'utilisation de module sans restriction; - (Copier) Copier des modules pour faciliter leur maintenance et leur pérennité; - (Étudier) De comprendre le comportement des fonctionnalités; -- (Modifier) Modifier un module existant pour l'améliorer et pouvoir le redistribuer à la communauté; +- (Modifier) Modifier un module existant pour l'améliorer et devoir le redistribuer à la communauté; ``` @@ -40,16 +40,16 @@ Modules 3. A Template reads a Module to generate a Code_Generator. -Il y a 3 types de module dans le contexte du générateur de code : -1. [A Template generates a Template or a Code_Generator.](#crer-votre-premier-code_generator), le chef d'orchestre qui permet de gérer plusieurs générateur de code. +Il y a 3 types de modules dans le contexte du générateur de code : +1. [A Template generates a Template or a Code_Generator.](#crer-votre-premier-code_generator), le chef d'orchestre qui permet de gérer plusieurs générateurs de code. 2. Un Code_Generator génère un module, c'est un moule à module généré. 3. Un Template lit un module pour générer un Code_Generator. -Warning, be careful to your code, always commit after a manipulation, because the mode enable_sync_code erase data, only the git will save you! +Warning, be careful with your code, always commit after a manipulation, because the mode enable_sync_code erase data, only Git will save you! -Attention pour ne pas écraser votre code, toujours commiter après une manipulation, l'utilisation du mode enable_sync_code peut effacer des données. Seul git vous sauvera! +Attention pour ne pas écraser votre code, toujours commiter après une manipulation, l'utilisation du mode enable_sync_code peut effacer des données. Seul Git vous sauvera! ## Manual generator with web interface @@ -91,7 +91,7 @@ make addons_install_code_generator_full make run_code_generator ``` -Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le déverminage. +Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le mode déverminage. Ouvrir l'application `Code Generator` et créer un `Module`. Remplir les champs requis et générer avec `Action/Generate code`. @@ -111,7 +111,7 @@ make run_code_generator TODO -Pour des références techniques, voir module : +Pour des références techniques, voir modules : - code_generator_template_demo_portal - code_generator_demo_portal - code_generator_demo_internal @@ -122,12 +122,12 @@ Pour des références techniques, voir module : TODO -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Application». -- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder. +Aller dans le module «Code generator» et créer un module «test»; +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Application»; +- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder; - Appuyer sur le bouton «Views» - - Appuyer «Generate» + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -155,7 +155,7 @@ make run_code_generator TODO -Pour des références techniques, voir module : +Pour des références techniques, voir modules : - code_generator_template_demo_portal - code_generator_demo_portal - code_generator_demo_internal @@ -166,15 +166,15 @@ Pour des références techniques, voir module : TODO -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Application». -- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder. +Aller dans le module «Code generator» et créer un module «test»; +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Application»; +- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder; - Appuyer sur le bouton «Views» - Désactiver «Enable all feature» - Dans l'onglet «Portal» - Activer «Enable portal feature» - - Appuyer «Generate» + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -203,10 +203,10 @@ Aller sur le portail pour visualiser les données, à l'adresse `/my`. TODO -Le crochet nommé «hook» permet d'exécuter du code en -- Pré-initialisation du module -- Post-initialisation du module -- Désinstallation du module +Le crochet nommé «hook» permet d'exécuter du code en: +- Pré-initialisation du module; +- Post-initialisation du module; +- Désinstallation du module. Pour des références techniques, voir module : - code_generator_demo @@ -223,10 +223,10 @@ TODO Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Hook» +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Hook»: - Activer «Show post_init_hook» - - Ajouter le code suivant dans la fenêtre qui est apparu : + - Ajouter le code suivant dans la fenêtre qui est apparue : ```python @@ -260,9 +260,9 @@ TODO Permettre d'exécuter du code basé sur des séquences de temps ou des moments spécifiques à répétition. Pour des références techniques, voir module : -- code_generator_template_demo_sysadmin_cron -- code_generator_auto_backup -- auto_backup +- code_generator_template_demo_sysadmin_cron; +- code_generator_auto_backup; +- auto_backup. ```bash @@ -276,13 +276,13 @@ TODO Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Cron» +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Cron»: - Ajouter un cron - - Choisir le «Modèle» : «Contact» - - Choisir unité de temps en «Minutes» dans «Exécuter tous les» - - Modifier «Nombre d'appel» à -1 pour exécution sans arrêt. - - Activer «Force nextcall» pour permettre que l'interval soit basé sur le moment d'installation du module + - Choisir le «Modèle» : «Contact»; + - Choisir unité de temps en «Minutes» dans «Exécuter tous les»; + - Modifier «Nombre d'appel» à -1 pour exécution sans arrêt; + - Activer «Force nextcall» pour permettre que l'interval soit basé sur le moment d'installation du module. - Ajouter le code : @@ -307,7 +307,7 @@ make run_test TODO -Avec les outils développeur, aller regarder les logs dans l'application «Configuration»/Technique/«Structure de base de donnée»/Historisation. Des informations dans le temps apparaîtront avec le mot «Coucou». +Avec les outils développeur, aller regarder les logs dans l'application «Configuration»/Technique/«Structure de base de données»/Historisation. Des informations dans le temps apparaîtront avec le mot «Coucou». ### Create website snippet module @@ -333,9 +333,9 @@ TODO Pour des références techniques, voir module : -- code_generator_template_demo_website_snippet -- code_generator_demo_website_snippet -- demo_website_snippet +- code_generator_template_demo_website_snippet; +- code_generator_demo_website_snippet; +- demo_website_snippet. Puis dans le repo addons/ERPLibre_erplibre_theme_addons, branche code_generator_erplibre_website_snippets - code_generator_erplibre_website_snippets @@ -350,10 +350,10 @@ Aller dans le module «Code generator» et créer un module «test». TODO Incomplet -### Create geoengine with Leaflet module +### Create GeoEngine with Leaflet module -### Créer un module de gestion de coordonnée géospatial avec Leaflet +### Créer un module de gestion de coordonnées géospatiales avec Leaflet ```bash @@ -367,31 +367,31 @@ TODO Pour des références techniques, voir module : -- code_generator_demo_website_leaflet -- demo_website_leaflet +- code_generator_demo_website_leaflet; +- demo_website_leaflet. TODO -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data» - - Activer «Application» - - Ajouter la dépendance du geo_engine «Geospatial support for System» -- Sur l'onglet «Elements»/«Models» - - Ajouter un modèle «test» - - Ajouter un champs de type «geo_». Le «geo_point» fonctionne bien. Si vous ajoutez plusieurs géométrie, tel que «geo_point», «geo_line» et «geo_polygon», il faut ajouter le champs «type» avec les valeurs du nom des champs choisis en option de sélection, exemple `[('geo_point', 'Geo Point'),('geo_polygon', 'Geo Polygon')]` - - Ajouter le champs optionnel «html_text» de type «html» pour pouvoir afficher du texte dessus. -- Appuyer sur le bouton «Controllers» - - Ajouter le modèle du module actuel, «test» - - Appuyer «Generate» -- Appuyer sur le bouton «Views» - - Désactiver «Enable all feature» - - Dans l'onglet «Website» - - Activer «Enable website leaflet feature» - - Activer «Enable geoengine feature» - - Appuyer «Generate» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data»: + - Activer «Application»; + - Ajouter la dépendance du geo_engine «Geospatial support for System»; +- Sur l'onglet «Elements»/«Models»: + - Ajouter un modèle «test»; + - Ajouter un champs de type «geo_». Le «geo_point» fonctionne bien. Si vous ajoutez plusieurs géométries, telles que «geo_point», «geo_line» et «geo_polygon», il faut ajouter le champs nommé «type» au type sélection avec les valeurs du nom des champs choisis en option de sélection, exemple `[('geo_point', 'Geo Point'),('geo_polygon', 'Geo Polygon')]` + - Ajouter le champs optionnel «html_text» de type «html» pour pouvoir afficher du texte dedans. +- Appuyer sur le bouton «Controllers»: + - Ajouter le modèle du module actuel, «test»; + - Appuyer «Generate». +- Appuyer sur le bouton «Views»: + - Désactiver «Enable all feature»; + - Dans l'onglet «Website»: + - Activer «Enable website leaflet feature»; + - Activer «Enable geoengine feature»; + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -423,7 +423,7 @@ TODO Pour des références techniques, voir module : -- code_generator_demo_theme_website +- code_generator_demo_theme_website. ```bash @@ -435,13 +435,13 @@ make run_code_generator TODO -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Website theme». -- Appuyer sur le bouton «Views» - - Aller à l'onglet «theme_website» - - Mettre les couleurs désirés - - Appuyer «Generate» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Website theme»; +- Appuyer sur le bouton «Views»: + - Aller à l'onglet «theme_website»: + - Mettre les couleurs désirés; + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -458,7 +458,7 @@ make run_test TODO -Aller dans l'interface web, Application «Configuration», «Paramètres Généraux»/«Site Web»/«Choisissez un thème». Installer le thème «TEST». Puis aller la page du site web, les couleurs sont dans «Personnaliser»/«Personnaliser le thème». +Aller dans l'interface web, Application «Configuration», «Paramètres Généraux»/«Site Web»/«Choisissez un thème». Installer le thème «TEST», puis aller la page du site web, les couleurs sont dans «Personnaliser»/«Personnaliser le thème». ### Extract data to module @@ -470,13 +470,13 @@ Aller dans l'interface web, Application «Configuration», «Paramètres Génér TODO -L'exemple est avec le helpdesk. Installer le module helpdesk_mgmt : +L'exemple est construit avec le helpdesk. Installer le module helpdesk_mgmt : Pour des références techniques, voir module : -- code_generator_demo_export_helpdesk -- code_generator_demo_export_website -- demo_website_data -- demo_helpdesk_data +- code_generator_demo_export_helpdesk; +- code_generator_demo_export_website; +- demo_website_data; +- demo_helpdesk_data. ```bash @@ -490,18 +490,18 @@ TODO Créer un ticket dans l'application «Helpdesk» dans l'interface web. -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Only export data». -- Appuyer sur le bouton «Models» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Only export data»; +- Appuyer sur le bouton «Models»: - Choisissez dans «Models» : - - «helpdesk.ticket» - - Activer «Clear field blacklisted» - - Enlever les éléments suivant de «Fields» : - - name - - description - - number - - Appuyer «Generate» + - «helpdesk.ticket»; + - Activer «Clear field blacklisted»; + - Enlever les éléments suivants de «Fields» : + - name; + - description; + - number; + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -510,10 +510,10 @@ make db_restore_erplibre_base_db_test_module_test ``` -### Migrate external database into module of migration +### Migrate external database into the migration module -### Migrer une base de donnée externe en module de migration +### Migrer une base de données externe en module de migration TODO @@ -534,7 +534,7 @@ make run_code_generator TODO -Aller dans le module «Code generator», menu «Databases»/«Databases» et créer un connecteur vers une base de donnée. +Aller dans le module «Code generator», menu «Databases»/«Databases» et créer un connecteur vers une base de données. À compléter... @@ -542,7 +542,7 @@ Aller dans le module «Code generator», menu «Databases»/«Databases» et cr ### Migrate from website to model with PDF data -### Migrer d'un site web vers un modèle de donnée avec des données format PDF +### Migrer d'un site web vers un modèle de données avec des données format PDF TODO @@ -550,13 +550,13 @@ TODO En progression, ce n'est pas encore supporté via l'interface web. -Cette technique permet d'aller lire du Javascript sur un site web pour lire ensuite le HTML, c'est à dire la vue, et en comprendre l'information pour créer un modèle. +Cette technique permet d'aller lire du Javascript sur un site web pour lire ensuite le HTML, c'est-à-dire la vue, et en comprendre l'information, pour créer un modèle. Pour des références techniques, voir module : -- code_generator_demo_converter_js -- business_plan_import_pdf +- code_generator_demo_converter_js; +- business_plan_import_pdf. -Attention, il faut mettre à jour les variables, dans les fichiers hook.py qui permettront d'extraire des données sur le site web à copier. Aucun exemple public n'est accessible pour le moment. +Attention, il faut mettre à jour les variables, dans les fichiers hook.py, qui permettront d'extraire des données sur le site web à copier. Aucun exemple public n'est accessible pour le moment. ```bash @@ -573,10 +573,10 @@ make db_restore_erplibre_base_db_test ## Préparer une BD -This will destroy and create database named `code_generator`. +This will destroy and create a database named `code_generator`. -Ceci va détruire et créer une base de donnée nommé `code_generator`. +Ceci va détruire et créer une base de données nommée `code_generator`. ```bash @@ -587,7 +587,7 @@ make db_restore_erplibre_base_db_code_generator TODO -Pour de meilleur performance d'exécution, réduire la quantité de «repo addons» permet d'accélérer l'installation, exécuter : +Pour de meilleures performances d'exécution, réduire la quantité de «repo addons» qui permet d'accélérer l'installation, exécuter : ```bash @@ -598,7 +598,7 @@ make config_gen_code_generator TODO -Pour revenir à la configuration normal, en production, exécuter : +Pour revenir à la configuration normale, en production, exécuter : ```bash @@ -624,9 +624,9 @@ Modifier [Code Generator Demo](./../addons/TechnoLibre_odoo-code-generator/code_ ### Générer un `Template` -By default, `code_generator_demo` generate itself, `code_generator_demo`. +By default, `code_generator_demo` generates itself, `code_generator_demo`. -Name your module begin with `MODULE_NAME = "code_generator_template_"` +Name your module beginning with `MODULE_NAME = "code_generator_template_"` The value "enable_template_code_generator_demo" at `False` to create a new template module, else this will recreate `code_generator_demo`. @@ -636,7 +636,7 @@ Par défaut, installer le module code_generator_demo va générer le module `cod Nommer votre module en commençant par `MODULE_NAME = "code_generator_template_"` -Example, to generate the module `code_generator_template_demo_website_snippet`, change value: +For example, to generate the module `code_generator_template_demo_website_snippet`, change value: Un exemple, générer le module `code_generator_template_demo_website_snippet`, changer la variable `value`: @@ -672,13 +672,13 @@ make addons_install_code_generator_demo ### Générer un Code_Generator (suite de template) -Name your module begin with `MODULE_NAME = "code_generator_"` +Name your module beginning with `MODULE_NAME = "code_generator_"` -Au besoin, renommé votre module qui débute par `MODULE_NAME = "code_generator_"` +Au besoin, renommer votre module qui débute par `MODULE_NAME = "code_generator_"` -Continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: +To continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: Pour continuer avec l'exemple, généré le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: @@ -705,12 +705,12 @@ Aller à la section [Créer votre premier module](#crer-votre-premier-module) TODO validate this -Name your module begin with `MODULE_NAME = "code_generator_demo_"` +Name your module beginning with `MODULE_NAME = "code_generator_demo_"` Disable `enable_template_code_generator_demo` -Nommé votre module qui débute par `MODULE_NAME = "code_generator_demo_"` +Nommer votre module qui débute par `MODULE_NAME = "code_generator_demo_"` Désactiver la variable `enable_template_code_generator_demo` @@ -720,10 +720,10 @@ value["enable_template_code_generator_demo"] = False ``` -Continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: +To continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: -Pour continuer avec l'exemple, généré le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: +Pour continuer avec l'exemple, générez le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: ```bash @@ -737,7 +737,7 @@ Pour continuer avec l'exemple, généré le template `code_generator_template_de ## Créer votre premier module -Continue example of code_generator_demo_website_snippet to generate your first module. Update next value: +To continue the example of code_generator_demo_website_snippet to generate your first module. Update next value: Continuer avec l'exemple du `code_generator_demo_website_snippet` pour générer votre premier module. Mettre à jour les valeurs suivantes : @@ -766,7 +766,7 @@ make db_restore_erplibre_base_db_code_generator ``` -Now, you can test it! Note, you cannot install a generated module with is code_generator associated, because duplicated +Now, you can test it! Note, you cannot install a generated module with his code_generator associated, because of duplicated models! @@ -801,7 +801,7 @@ value["template_model_name"] = "test;test2" TODO -Exécuter l'installation du template pour qu'il se synchronise sur le module généré. +Exécuter l'installation du template pour qu'il se synchronise avec le module généré. ```bash @@ -842,7 +842,7 @@ code_generator_writer.set_module_translator(new_module_name, new_module_path) ``` -First, install the module, example `demo_portal`, and after the template, example `code_generator_template_demo_portal`. +First, install the module, for example `demo_portal`, and after the template, for example `code_generator_template_demo_portal`. Premièrement, installer le module, par exemple `demo_portal`, et ensuite le template, par exemple `code_generator_template_demo_portal`. @@ -861,7 +861,7 @@ make db_restore_erplibre_base_db_code_generator # Synchroniser les champs du `Code_Generator` du module -This reduce time of programming a `Code_Generator` with sync module field with `Template`. +This reduce the time it takes for programming a `Code_Generator` with sync module field with `Template`. You need a `Template`, a `Code_Generator` with his `Module`. Install the `Module` first in clean database and install `Template`, this will generate the `Code_Generator`, use `enable_sync_template` at True. @@ -871,7 +871,7 @@ Example: Ceci va permettre de réduire le temps de programmation d'un `Code_Generator` avec la synchronisation des champs de module avec `Template`. -On a besoin d'un `Template`, un `Code_Generator` accompagné de son module. Installer le module en premier dans une base de donnée nettoyé et installer le `Template`, ceci va générer le `Code_Generator`, utiliser `enable_sync_template` à la valeur `True`. +On a besoin d'un `Template`, un `Code_Generator` accompagné de son module. Installer le module en premier dans une base de données nettoyée et installer le `Template`, ceci va générer le `Code_Generator`, utiliser `enable_sync_template` à la valeur `True`. Exemple : @@ -914,7 +914,7 @@ make test_code_generator_generation TODO -Tester les générations extra : +Tester les générations extras : ```bash diff --git a/doc/CODE_GENERATOR.fr.md b/doc/CODE_GENERATOR.fr.md index c7d9a03..c4eee76 100644 --- a/doc/CODE_GENERATOR.fr.md +++ b/doc/CODE_GENERATOR.fr.md @@ -1,9 +1,9 @@ # Comment générer du code -Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendance circulaire pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. +Ne jamais exécuter le générateur de code dans un environnement de production, il y a création de dépendances circulaires pouvant causer de la frustration à nettoyer tous les dommages. D'ailleurs, il est nécessaire d'exécuter en mode développement, avec l'argument `--dev all`. L'objectif du générateur de code est de : -- utilisation du générateur via l'interface web; +- utiliser le générateur via l'interface web; - créer un nouveau module; - modifier un module existant; - exécuter les tests. @@ -12,7 +12,7 @@ Ce générateur de code, pour ERPLibre, a tout avantage d'être sous licence AGP - (Utiliser) L'utilisation de module sans restriction; - (Copier) Copier des modules pour faciliter leur maintenance et leur pérennité; - (Étudier) De comprendre le comportement des fonctionnalités; -- (Modifier) Modifier un module existant pour l'améliorer et pouvoir le redistribuer à la communauté; +- (Modifier) Modifier un module existant pour l'améliorer et devoir le redistribuer à la communauté; ``` Modules @@ -21,12 +21,12 @@ Modules ############ ################## ########## ``` -Il y a 3 types de module dans le contexte du générateur de code : -1. [A Template generates a Template or a Code_Generator.](#crer-votre-premier-code_generator), le chef d'orchestre qui permet de gérer plusieurs générateur de code. +Il y a 3 types de modules dans le contexte du générateur de code : +1. [A Template generates a Template or a Code_Generator.](#crer-votre-premier-code_generator), le chef d'orchestre qui permet de gérer plusieurs générateurs de code. 2. Un Code_Generator génère un module, c'est un moule à module généré. 3. Un Template lit un module pour générer un Code_Generator. -Attention pour ne pas écraser votre code, toujours commiter après une manipulation, l'utilisation du mode enable_sync_code peut effacer des données. Seul git vous sauvera! +Attention pour ne pas écraser votre code, toujours commiter après une manipulation, l'utilisation du mode enable_sync_code peut effacer des données. Seul Git vous sauvera! ## Générateur de module avec l'interface web @@ -52,7 +52,7 @@ make addons_install_code_generator_full make run_code_generator ``` -Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le déverminage. +Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le mode déverminage. Ouvrir l'application `Code Generator` et créer un `Module`. Remplir les champs requis et générer avec `Action/Generate code`. @@ -63,19 +63,19 @@ make addons_install_code_generator_basic make run_code_generator ``` -Pour des références techniques, voir module : +Pour des références techniques, voir modules : - code_generator_template_demo_portal - code_generator_demo_portal - code_generator_demo_internal - demo_portal - demo_internal -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Application». -- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder. +Aller dans le module «Code generator» et créer un module «test»; +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Application»; +- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder; - Appuyer sur le bouton «Views» - - Appuyer «Generate» + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -93,22 +93,22 @@ make addons_install_code_generator_basic make run_code_generator ``` -Pour des références techniques, voir module : +Pour des références techniques, voir modules : - code_generator_template_demo_portal - code_generator_demo_portal - code_generator_demo_internal - demo_portal - demo_internal -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Application». -- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder. +Aller dans le module «Code generator» et créer un module «test»; +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Application»; +- Sur l'onglet «Elements»/«Models», ajouter un modèle et sauvegarder; - Appuyer sur le bouton «Views» - Désactiver «Enable all feature» - Dans l'onglet «Portal» - Activer «Enable portal feature» - - Appuyer «Generate» + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -124,10 +124,10 @@ Aller sur le portail pour visualiser les données, à l'adresse `/my`. ### Créer un module crochet pour l'installation -Le crochet nommé «hook» permet d'exécuter du code en -- Pré-initialisation du module -- Post-initialisation du module -- Désinstallation du module +Le crochet nommé «hook» permet d'exécuter du code en: +- Pré-initialisation du module; +- Post-initialisation du module; +- Désinstallation du module. Pour des références techniques, voir module : - code_generator_demo @@ -139,10 +139,10 @@ make run_code_generator ``` Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Hook» +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Hook»: - Activer «Show post_init_hook» - - Ajouter le code suivant dans la fenêtre qui est apparu : + - Ajouter le code suivant dans la fenêtre qui est apparue : ```python with api.Environment.manage(): @@ -162,9 +162,9 @@ make db_restore_erplibre_base_db_test_module_test Permettre d'exécuter du code basé sur des séquences de temps ou des moments spécifiques à répétition. Pour des références techniques, voir module : -- code_generator_template_demo_sysadmin_cron -- code_generator_auto_backup -- auto_backup +- code_generator_template_demo_sysadmin_cron; +- code_generator_auto_backup; +- auto_backup. ```bash make addons_install_code_generator_basic @@ -173,13 +173,13 @@ make run_code_generator ``` Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Cron» +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Cron»: - Ajouter un cron - - Choisir le «Modèle» : «Contact» - - Choisir unité de temps en «Minutes» dans «Exécuter tous les» - - Modifier «Nombre d'appel» à -1 pour exécution sans arrêt. - - Activer «Force nextcall» pour permettre que l'interval soit basé sur le moment d'installation du module + - Choisir le «Modèle» : «Contact»; + - Choisir unité de temps en «Minutes» dans «Exécuter tous les»; + - Modifier «Nombre d'appel» à -1 pour exécution sans arrêt; + - Activer «Force nextcall» pour permettre que l'interval soit basé sur le moment d'installation du module. - Ajouter le code : ```python @@ -194,7 +194,7 @@ make db_restore_erplibre_base_db_test_module_test make run_test ``` -Avec les outils développeur, aller regarder les logs dans l'application «Configuration»/Technique/«Structure de base de donnée»/Historisation. Des informations dans le temps apparaîtront avec le mot «Coucou». +Avec les outils développeur, aller regarder les logs dans l'application «Configuration»/Technique/«Structure de base de données»/Historisation. Des informations dans le temps apparaîtront avec le mot «Coucou». ### Créer un module de snippet pour le site web @@ -207,9 +207,9 @@ make run_code_generator ``` Pour des références techniques, voir module : -- code_generator_template_demo_website_snippet -- code_generator_demo_website_snippet -- demo_website_snippet +- code_generator_template_demo_website_snippet; +- code_generator_demo_website_snippet; +- demo_website_snippet. Puis dans le repo addons/ERPLibre_erplibre_theme_addons, branche code_generator_erplibre_website_snippets - code_generator_erplibre_website_snippets @@ -219,7 +219,7 @@ Aller dans le module «Code generator» et créer un module «test». TODO Incomplet -### Créer un module de gestion de coordonnée géospatial avec Leaflet +### Créer un module de gestion de coordonnées géospatiales avec Leaflet ```bash make addons_install_code_generator_basic @@ -228,27 +228,27 @@ make run_code_generator ``` Pour des références techniques, voir module : -- code_generator_demo_website_leaflet -- demo_website_leaflet +- code_generator_demo_website_leaflet; +- demo_website_leaflet. -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data» - - Activer «Application» - - Ajouter la dépendance du geo_engine «Geospatial support for System» -- Sur l'onglet «Elements»/«Models» - - Ajouter un modèle «test» - - Ajouter un champs de type «geo_». Le «geo_point» fonctionne bien. Si vous ajoutez plusieurs géométrie, tel que «geo_point», «geo_line» et «geo_polygon», il faut ajouter le champs «type» avec les valeurs du nom des champs choisis en option de sélection, exemple `[('geo_point', 'Geo Point'),('geo_polygon', 'Geo Polygon')]` - - Ajouter le champs optionnel «html_text» de type «html» pour pouvoir afficher du texte dessus. -- Appuyer sur le bouton «Controllers» - - Ajouter le modèle du module actuel, «test» - - Appuyer «Generate» -- Appuyer sur le bouton «Views» - - Désactiver «Enable all feature» - - Dans l'onglet «Website» - - Activer «Enable website leaflet feature» - - Activer «Enable geoengine feature» - - Appuyer «Generate» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data»: + - Activer «Application»; + - Ajouter la dépendance du geo_engine «Geospatial support for System»; +- Sur l'onglet «Elements»/«Models»: + - Ajouter un modèle «test»; + - Ajouter un champs de type «geo_». Le «geo_point» fonctionne bien. Si vous ajoutez plusieurs géométries, telles que «geo_point», «geo_line» et «geo_polygon», il faut ajouter le champs nommé «type» au type sélection avec les valeurs du nom des champs choisis en option de sélection, exemple `[('geo_point', 'Geo Point'),('geo_polygon', 'Geo Polygon')]` + - Ajouter le champs optionnel «html_text» de type «html» pour pouvoir afficher du texte dedans. +- Appuyer sur le bouton «Controllers»: + - Ajouter le modèle du module actuel, «test»; + - Appuyer «Generate». +- Appuyer sur le bouton «Views»: + - Désactiver «Enable all feature»; + - Dans l'onglet «Website»: + - Activer «Enable website leaflet feature»; + - Activer «Enable geoengine feature»; + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -267,20 +267,20 @@ Aller sur la page du site web, ajouter le snippet «Leaflet». Chercher le point ### Créer un module thème pour site web Pour des références techniques, voir module : -- code_generator_demo_theme_website +- code_generator_demo_theme_website. ```bash make addons_install_code_generator_basic ./script/addons/install_addons.sh code_generator code_generator_theme_website make run_code_generator ``` -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Website theme». -- Appuyer sur le bouton «Views» - - Aller à l'onglet «theme_website» - - Mettre les couleurs désirés - - Appuyer «Generate» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Website theme»; +- Appuyer sur le bouton «Views»: + - Aller à l'onglet «theme_website»: + - Mettre les couleurs désirés; + - Appuyer «Generate». Générer le module avec «Action/Générer code». @@ -292,17 +292,17 @@ make db_restore_erplibre_base_db_test make run_test ``` -Aller dans l'interface web, Application «Configuration», «Paramètres Généraux»/«Site Web»/«Choisissez un thème». Installer le thème «TEST». Puis aller la page du site web, les couleurs sont dans «Personnaliser»/«Personnaliser le thème». +Aller dans l'interface web, Application «Configuration», «Paramètres Généraux»/«Site Web»/«Choisissez un thème». Installer le thème «TEST», puis aller la page du site web, les couleurs sont dans «Personnaliser»/«Personnaliser le thème». ### Extraire les données vers un module -L'exemple est avec le helpdesk. Installer le module helpdesk_mgmt : +L'exemple est construit avec le helpdesk. Installer le module helpdesk_mgmt : Pour des références techniques, voir module : -- code_generator_demo_export_helpdesk -- code_generator_demo_export_website -- demo_website_data -- demo_helpdesk_data +- code_generator_demo_export_helpdesk; +- code_generator_demo_export_website; +- demo_website_data; +- demo_helpdesk_data. ```bash make addons_install_code_generator_basic @@ -311,25 +311,25 @@ make run_code_generator ``` Créer un ticket dans l'application «Helpdesk» dans l'interface web. -Aller dans le module «Code generator» et créer un module «test». -- Sur l'onglet «Information», activer «Enable Sync Code» -- Sur l'onglet «Technical Data», activer «Only export data». -- Appuyer sur le bouton «Models» +Aller dans le module «Code generator» et créer un module «test»: +- Sur l'onglet «Information», activer «Enable Sync Code»; +- Sur l'onglet «Technical Data», activer «Only export data»; +- Appuyer sur le bouton «Models»: - Choisissez dans «Models» : - - «helpdesk.ticket» - - Activer «Clear field blacklisted» - - Enlever les éléments suivant de «Fields» : - - name - - description - - number - - Appuyer «Generate» + - «helpdesk.ticket»; + - Activer «Clear field blacklisted»; + - Enlever les éléments suivants de «Fields» : + - name; + - description; + - number; + - Appuyer «Generate». Générer le module avec «Action/Générer code». ```bash make db_restore_erplibre_base_db_test_module_test ``` -### Migrer une base de donnée externe en module de migration +### Migrer une base de données externe en module de migration En progression. @@ -341,21 +341,21 @@ make addons_install_code_generator_basic ./script/addons/install_addons.sh code_generator code_generator_db_servers make run_code_generator ``` -Aller dans le module «Code generator», menu «Databases»/«Databases» et créer un connecteur vers une base de donnée. +Aller dans le module «Code generator», menu «Databases»/«Databases» et créer un connecteur vers une base de données. À compléter... -### Migrer d'un site web vers un modèle de donnée avec des données format PDF +### Migrer d'un site web vers un modèle de données avec des données format PDF En progression, ce n'est pas encore supporté via l'interface web. -Cette technique permet d'aller lire du Javascript sur un site web pour lire ensuite le HTML, c'est à dire la vue, et en comprendre l'information pour créer un modèle. +Cette technique permet d'aller lire du Javascript sur un site web pour lire ensuite le HTML, c'est-à-dire la vue, et en comprendre l'information, pour créer un modèle. Pour des références techniques, voir module : -- code_generator_demo_converter_js -- business_plan_import_pdf +- code_generator_demo_converter_js; +- business_plan_import_pdf. -Attention, il faut mettre à jour les variables, dans les fichiers hook.py qui permettront d'extraire des données sur le site web à copier. Aucun exemple public n'est accessible pour le moment. +Attention, il faut mettre à jour les variables, dans les fichiers hook.py, qui permettront d'extraire des données sur le site web à copier. Aucun exemple public n'est accessible pour le moment. ```bash make db_restore_erplibre_base_db_code_generator @@ -366,19 +366,19 @@ make db_restore_erplibre_base_db_test ## Préparer une BD -Ceci va détruire et créer une base de donnée nommé `code_generator`. +Ceci va détruire et créer une base de données nommée `code_generator`. ```bash make db_restore_erplibre_base_db_code_generator ``` -Pour de meilleur performance d'exécution, réduire la quantité de «repo addons» permet d'accélérer l'installation, exécuter : +Pour de meilleures performances d'exécution, réduire la quantité de «repo addons» qui permet d'accélérer l'installation, exécuter : ```bash make config_gen_code_generator ``` -Pour revenir à la configuration normal, en production, exécuter : +Pour revenir à la configuration normale, en production, exécuter : ```bash make config_gen_all @@ -416,7 +416,7 @@ make addons_install_code_generator_demo ### Générer un Code_Generator (suite de template) -Au besoin, renommé votre module qui débute par `MODULE_NAME = "code_generator_"` +Au besoin, renommer votre module qui débute par `MODULE_NAME = "code_generator_"` Pour continuer avec l'exemple, généré le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: @@ -429,7 +429,7 @@ Aller à la section [Créer votre premier module](#crer-votre-premier-module) ### Générer un Code_Generator_Demo -Nommé votre module qui débute par `MODULE_NAME = "code_generator_demo_"` +Nommer votre module qui débute par `MODULE_NAME = "code_generator_demo_"` Désactiver la variable `enable_template_code_generator_demo` @@ -437,7 +437,7 @@ Désactiver la variable `enable_template_code_generator_demo` value["enable_template_code_generator_demo"] = False ``` -Pour continuer avec l'exemple, généré le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: +Pour continuer avec l'exemple, générez le template `code_generator_template_demo_website_snippet`, ceci va écraser `code_generator_demo_website_snippet`: ```bash ./script/addons/install_addons_dev.sh code_generator code_generator_template_demo_website_snippet @@ -483,7 +483,7 @@ value["enable_template_wizard_view"] = True value["template_model_name"] = "test;test2" ``` -Exécuter l'installation du template pour qu'il se synchronise sur le module généré. +Exécuter l'installation du template pour qu'il se synchronise avec le module généré. ```bash make db_restore_erplibre_base_db_template @@ -520,7 +520,7 @@ make db_restore_erplibre_base_db_code_generator Ceci va permettre de réduire le temps de programmation d'un `Code_Generator` avec la synchronisation des champs de module avec `Template`. -On a besoin d'un `Template`, un `Code_Generator` accompagné de son module. Installer le module en premier dans une base de donnée nettoyé et installer le `Template`, ceci va générer le `Code_Generator`, utiliser `enable_sync_template` à la valeur `True`. +On a besoin d'un `Template`, un `Code_Generator` accompagné de son module. Installer le module en premier dans une base de données nettoyée et installer le `Template`, ceci va générer le `Code_Generator`, utiliser `enable_sync_template` à la valeur `True`. Exemple : @@ -544,7 +544,7 @@ Tester les générations simples : make test_code_generator_generation ``` -Tester les générations extra : +Tester les générations extras : ```bash make test_code_generator_generation_extra diff --git a/doc/CODE_GENERATOR.md b/doc/CODE_GENERATOR.md index 6f5dc4c..56db336 100644 --- a/doc/CODE_GENERATOR.md +++ b/doc/CODE_GENERATOR.md @@ -13,7 +13,7 @@ Modules 2. A Code_Generator generates a Module. 3. A Template reads a Module to generate a Code_Generator. -Warning, be careful to your code, always commit after a manipulation, because the mode enable_sync_code erase data, only the git will save you! +Warning, be careful with your code, always commit after a manipulation, because the mode enable_sync_code erase data, only Git will save you! ## Manual generator with web interface @@ -34,7 +34,7 @@ make addons_install_code_generator_full make run_code_generator ``` -Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le déverminage. +Ouvrir le navigateur sur [http://localhost:8069](http://localhost:8069). Utilisateur `test` et mot de passe `test`. Une fois connecté, ouvrir sur [http://localhost:8069/web?debug=](http://localhost:8069/web?debug=) pour activer le mode déverminage. Ouvrir l'application `Code Generator` et créer un `Module`. Remplir les champs requis et générer avec `Action/Generate code`. @@ -136,7 +136,7 @@ TODO TODO -### Create geoengine with Leaflet module +### Create GeoEngine with Leaflet module ```bash make addons_install_code_generator_basic @@ -189,7 +189,7 @@ TODO make db_restore_erplibre_base_db_test_module_test ``` -### Migrate external database into module of migration +### Migrate external database into the migration module TODO @@ -213,7 +213,7 @@ make db_restore_erplibre_base_db_test ## Prepare a DB -This will destroy and create database named `code_generator`. +This will destroy and create a database named `code_generator`. ```bash make db_restore_erplibre_base_db_code_generator @@ -237,13 +237,13 @@ Edit [Code Generator Demo](./../addons/TechnoLibre_odoo-code-generator/code_gene ### Generate a `Template` -By default, `code_generator_demo` generate itself, `code_generator_demo`. +By default, `code_generator_demo` generates itself, `code_generator_demo`. -Name your module begin with `MODULE_NAME = "code_generator_template_"` +Name your module beginning with `MODULE_NAME = "code_generator_template_"` The value "enable_template_code_generator_demo" at `False` to create a new template module, else this will recreate `code_generator_demo`. -Example, to generate the module `code_generator_template_demo_website_snippet`, change value: +For example, to generate the module `code_generator_template_demo_website_snippet`, change value: ```python MODULE_NAME = "code_generator_template_demo_website_snippet" @@ -265,9 +265,9 @@ make addons_install_code_generator_demo ### Generate a Code_Generator (continue template) -Name your module begin with `MODULE_NAME = "code_generator_"` +Name your module beginning with `MODULE_NAME = "code_generator_"` -Continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: +To continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: ```bash make db_restore_erplibre_base_db_template @@ -278,7 +278,7 @@ Go to section [Create your first module](#create-your-first-module) ### Generate a Code_Generator_Demo -Name your module begin with `MODULE_NAME = "code_generator_demo_"` +Name your module beginning with `MODULE_NAME = "code_generator_demo_"` Disable `enable_template_code_generator_demo` @@ -286,7 +286,7 @@ Disable `enable_template_code_generator_demo` value["enable_template_code_generator_demo"] = False ``` -Continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: +To continue the example, you generated the template `code_generator_template_demo_website_snippet`, this will overwrite `code_generator_demo_website_snippet`: ```bash ./script/addons/install_addons_dev.sh code_generator code_generator_template_demo_website_snippet @@ -294,7 +294,7 @@ Continue the example, you generated the template `code_generator_template_demo_w ## Create your first Module -Continue example of code_generator_demo_website_snippet to generate your first module. Update next value: +To continue the example of code_generator_demo_website_snippet to generate your first module. Update next value: ```python "application": True, @@ -313,7 +313,7 @@ make db_restore_erplibre_base_db_code_generator ./script/addons/install_addons_dev.sh code_generator code_generator_demo_website_snippet ``` -Now, you can test it! Note, you cannot install a generated module with is code_generator associated, because duplicated +Now, you can test it! Note, you cannot install a generated module with his code_generator associated, because of duplicated models! @@ -354,7 +354,7 @@ new_module_path = os.path.join(path_module_generate, new_module_name) code_generator_writer.set_module_translator(new_module_name, new_module_path) ``` -First, install the module, example `demo_portal`, and after the template, example `code_generator_template_demo_portal`. +First, install the module, for example `demo_portal`, and after the template, for example `code_generator_template_demo_portal`. ```bash make db_restore_erplibre_base_db_code_generator @@ -364,7 +364,7 @@ make db_restore_erplibre_base_db_code_generator # Sync Code_Generator fields from Module -This reduce time of programming a `Code_Generator` with sync module field with `Template`. +This reduce the time it takes for programming a `Code_Generator` with sync module field with `Template`. You need a `Template`, a `Code_Generator` with his `Module`. Install the `Module` first in clean database and install `Template`, this will generate the `Code_Generator`, use `enable_sync_template` at True. diff --git a/doc/CONTRIBUTION.md b/doc/CONTRIBUTION.md index 4052eee..51484e4 100644 --- a/doc/CONTRIBUTION.md +++ b/doc/CONTRIBUTION.md @@ -1,16 +1,25 @@ # Thanks + ## AGILE OPS -Thanks for contributing to GIT_REPO and docker. -- [Agile OPS](https://www.linkedin.com/in/michaelfaille/) + +Thanks to [Agile OPS](https://www.linkedin.com/in/michaelfaille/) for contributing to GIT_REPO and docker. ## MathBenTech -Thanks for creating this project. -- [MathBen.Tech](https://mathben.tech) + +Thanks to [MathBenTech](https://mathben.tech) for creating ERPLibre project. + +## Marieplume + +Thanks to [Marieplume](https://marieplume.ca) for keeping the language in check. + +## OCA + +Thanks to [Odoo Community Association](https://odoo-community.org) for the collaborative development of Odoo features. ## TechnoLibre -Thanks for making this enterprise edition of ERPLibre. -- [TechnoLibre](https://technolibre.ca) + +Thanks to [TechnoLibre](https://technolibre.ca) for making this enterprise edition of ERPLibre. ## Yenthe Van Ginneken -Thanks Yenthe Van Ginneken for your scripting guides and tutorials. -- [Yenthe666 InstallScript](https://github.com/Yenthe666/InstallScript) + +Thanks [Yenthe666 InstallScript](https://github.com/Yenthe666/InstallScript) for your scripting guides and tutorials. diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md index 74c07fc..57d80c7 100644 --- a/doc/DEVELOPMENT.md +++ b/doc/DEVELOPMENT.md @@ -1,13 +1,17 @@ # Development guide + Setup your environment to develop modules and debug the platform. ## Local installation procedure + ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git ``` ### 2. Execute the script: + ```bash cd ERPLibre ./script/install_dev.sh @@ -15,157 +19,205 @@ cd ERPLibre ``` ### 3. Run ERPLibre + ```bash ./run.sh ``` ## Develop in Odoo repository -You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. -Make a temporary commit and regenerate with `./script/install_locally_dev.sh` + +You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. Make a +temporary commit and regenerate with `./script/install_locally_dev.sh` ## Fork project to create a new project independent from ERPLibre (deprecated) -ERPLibre was created by this script. It's now deprecated. -Use this script when you need to fork directly from the original source. -Don't use this script if you want to update from ERPLibre and follow mainstream development. + +ERPLibre was created with this script. It's now deprecated. Use this script when you need to fork directly from the +original source. Don't use this script if you want to update from ERPLibre and follow mainstream development. + ```bash ./script/fork_project.py --github_token GITHUB_KEY --organization NAME ``` # Fork all repos for you own organization -Go to your github account and generate a token to access fork option with your user. Create an organization or use your personal account can choose your user name. -This command will fork all repos and ERPLibre to your own organization. It keeps track to ERPLibre. +Go to your Github account and generate a token to access fork option with your user. Create an organization or use your +personal account and choose your user name. + +This command will fork all repos and ERPLibre to your own organization. It keeps track of ERPLibre. + ```bash ./script/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME ``` ## Generate manifest from csv repo + Add repo in file [./source_repo_addons.csv](./source_repo_addons.csv) Execute to generate Repo manifest + ```bash ./script/fork_project_ERPLibre.py --skip_fork ``` -## Move database prod to dev -When moving database prod to your dev environment, you want to remove email servers and install user test in order to test the database. -Run: +## Move database from prod to dev + +When moving database from prod to your dev environment, you want to remove email servers and install user test in order +to test the database. Run: + ```bash ./run.sh --stop-after-init -i user_test,disable_mail_server --dev all -d DATABASE ``` -## Change git url https to git -This will update all urls in git format: +## Change git url https to Git + +This will update all urls in Git format: + ```bash ./script/git_change_remote_https_to_git.py ``` ## Showing repo differences between projects + Tools to display the differences between the repo and another project. + ```bash ./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync ``` ## Showing repo differences with manifest develop -To understand the divergence with the dev manifest. + +To understand the divergences with the dev manifest. + ```bash ./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml ``` ## Sync repo with another project -Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in all repos. + +Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in +all repos. + ```bash ./script/git_change_remote.py --sync_to /path/to/project/erplibre ``` ## Compare two files manifests + To show differences between commits in different manifests + ```bash ./script/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml ``` ## Differences between code and manifest + To show differences between actual code and manifest + ```bash ./script/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml ``` ## Add repo + To access a new repo, add your URL to file [source_repo_addons.csv](../source_repo_addons.csv) Fork the repo to be able to push new code: + ```bash ./script/fork_project_ERPLibre.py ``` To regenerate only manifest.xml. + ```bash ./script/fork_project_ERPLibre.py --skip_fork ``` Check if manifest contains "auto_install" and change the value to False. + ```bash ./script/repo_remove_auto_install.py ``` ## Filter repo by group + Only keep repo tagged by group 'base' and 'code_generator' + ```bash ./script/update_manifest_local_dev_code_generator.sh ``` # Execution + ## Config file + You can limit your addons in ERPlibre config file depending on a group of your actual manifest. + ```bash ./script/git_repo_update_group.py --group base,code_generator ./script/install_locally.sh ``` + Or go back to normal + ```bash ./script/git_repo_update_group.py ./script/install_locally.sh ``` # Coding + ## Create module scaffold + ```bash source ./.venv/bin/activate python odoo/odoo-bin scaffold MODULE_NAME addons/REPO_NAME/ ``` # Pull request + ## Show all pull requests from organization + ```bash /script/pull_request_ERPLibre.py --github_token ### --organization ERPLibre ``` # Commit + Use this commit format: + ```bash git commit -am "[#ticket] subject: short sentence" ``` # Format code + ## Python + Use [black](https://github.com/psf/black) + ```bash ./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator ``` Or if you prefer [oca-autopep8](https://github.com/psf/black) + ```bash ./script/maintenance/autopep8.sh ./addons/TechnoLibre_odoo-code-generator ``` ## HTML and css + Use [prettier](https://github.com/prettier/prettier) + ```bash ./script/maintenance/prettier.sh ./addons/TechnoLibre_odoo-code-generator ``` ## Javascript + Use [prettier](https://github.com/prettier/prettier) + ```bash ./script/maintenance/prettier.sh --tab-width 4 ./addons/TechnoLibre_odoo-code-generator ``` diff --git a/doc/DISCOVER.md b/doc/DISCOVER.md index 138f44f..1a83a63 100644 --- a/doc/DISCOVER.md +++ b/doc/DISCOVER.md @@ -1,13 +1,17 @@ # Discover + Explore the ERPLibre solution. ## Fast installation + ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git ``` ### 2. Run installation locally: + ```bash cd ERPLibre ./script/install_dev.sh @@ -15,14 +19,17 @@ cd ERPLibre ``` ### 3. Run ERPLibre + ```bash ./run.sh ``` ## Add repo + To access a new repo, add your URL to file [source_repo_addons.csv](../source_repo_addons.csv) Execute script: + ```bash ./script/git_repo_manifest.py git checkout -b NEW_BRANCH @@ -30,4 +37,5 @@ git commit -am "Add new repo" ./script/install_locally_dev.sh ./script/poetry_update.py ``` + [Update your repo.](./GIT_REPO.md) diff --git a/doc/FAQ.md b/doc/FAQ.md index 1d69a77..285ebd6 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -1,21 +1,31 @@ # FAQ + ## Networking + Show all open port + ```bash sudo lsof -i -P -n | grep LISTEN ``` + or + ```bash sudo netstat -lpnt | grep LISTEN ``` + or + ```bash sudo ss -lpnt | grep LISTEN ``` ## git-repo + ### error.GitError fatal bad revision + Example: + ``` error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a', 'HEAD', '--'): fatal: bad revision 'HEAD' ``` @@ -23,6 +33,7 @@ error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a' Did you modify files in .repo? To reset files from your branch into .repo: + ```bash cd .repo/manifests git branch -av @@ -32,4 +43,4 @@ git branch -av # To reset the "remotes/origin" use the same as "remotes/m" git reset --hard REF_OF_REMOTES/m > git reset --hard remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208 -``` \ No newline at end of file +``` diff --git a/doc/GIT_REPO.md b/doc/GIT_REPO.md index 05e9254..1dd0a04 100644 --- a/doc/GIT_REPO.md +++ b/doc/GIT_REPO.md @@ -1,27 +1,34 @@ # git-repo + This is a guide to understand git-repo. Scripts in ERPLibre use git-repo automatically. -[git-repo of Google](https://code.google.com/archive/p/git-repo) is used to manage all git repositories under licence [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html). +[git-repo of Google](https://code.google.com/archive/p/git-repo) is used to manage all git repositories under +licence [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html). ## Setup repo + ```bash curl https://storage.googleapis.com/git-repo-downloads/repo > ./.venv/repo ``` ## prod + ```bash ./.venv/repo init -u https://github.com/ERPLibre/ERPLibre -b master ./.venv/repo sync ``` ## dev + ```bash ./.venv/repo init -u https://github.com/ERPLibre/ERPLibre -b 12.0_repo -m ./manifest/default.dev.xml ./.venv/repo sync ``` ## local dev + [Guide to setup locally git](https://railsware.com/blog/taming-the-git-daemon-to-quickly-share-git-repository/). + ```bash git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & @@ -30,21 +37,31 @@ git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose ``` # Create Manifest -A [Manifest](https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md), is a XML file managed by git-repo to generate repo. + +A [Manifest](https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md), is an XML file managed by +git-repo to generate a repo. ## Make a new version of prod + It freezes all repo, from dev to prod. -This will add revision git hash in the Manifest. +This will add revision git hash in the manifest. + ```bash ./.venv/repo manifest -r -o ./default.xml ``` + Commit. + ```bash git commit -am "[#ticket] subject: short sentence" ``` + ### Mix prod and dev to create a stage version -When dev contains specific revision with default revision, you need to replace default revision with prod revision and keep specific version: + +When dev contains specific revision with default revision, you need to replace default revision with prod revision and +keep specific version: + ```bash ./script/git_merge_repo_manifest.py --input1 ./manifest/default.dev.xml --input2 ./default.xml --output ./manifest/default.staged.xml git commit -am "Updated manifest/default.staged.xml" @@ -56,33 +73,42 @@ git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose ./.venv/repo manifest -r -o ./default.xml ``` + ## Create a dev version + ```bash ./.venv/repo manifest -o ./manifest/default.dev.xml ``` + Commit. + ```bash git commit -am "[#ticket] subject: short sentence" ``` ## Useful commands -### Search all repo with a specific branch name + +### Search all repos with a specific branch name + ```bash ./.venv/repo forall -pc "git branch -a|grep BRANCH" ``` ### Search missing branch in all repos + ```bash ./.venv/repo forall -pc 'git branch -a|(grep /BRANCH$||echo "no match")|grep "no match"' ``` ### Search changed file in all repos + ```bash ./.venv/repo forall -pc "git status -s" ``` ### Clean all -Before, check changed file in all repos. + +Before cleaning, check changed file in all repos. ```bash ./.venv/repo forall -pc "git status -s" @@ -95,6 +121,7 @@ Check the changed branch, and push changed if needed. ``` Maybe, some version diverge from your manifest. Simply clean all and relaunch your installation. + ```bash ./script/clean_repo_manifest.sh -``` \ No newline at end of file +``` diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 4f2b2f0..f501c64 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -1,3 +1,5 @@ # HOW TO + ## Update changelog + Please read the following documentation [keepachangelog.com](https://keepachangelog.com) diff --git a/doc/MIGRATION.md b/doc/MIGRATION.md deleted file mode 100644 index 847aa87..0000000 --- a/doc/MIGRATION.md +++ /dev/null @@ -1,29 +0,0 @@ -# ERPLibre - -## Migration procedure in production - -TODO - -## Migration procedure in dev - -Example: - -update module helpdesk_mgmt and helpdesk_join_team - -update translation all - -Remove helpdesk_res_partner_team - -Delete module not found - -smile_upgrade? - -update html categorie_id - -join_team == 6 - -servicecall == 1 - ---limit-time-real 99999 -c config.conf --stop-after-init -d santelibre -i helpdesk_mrp -i erplibre_base_enterprise_mrp,erplibre_base_hackaton,helpdesk_mgmt -u helpdesk_join_team - ---limit-time-real 99999 -c config.conf --stop-after-init -d santelibre -u helpdesk_join_team diff --git a/doc/POETRY.md b/doc/POETRY.md index df94ae7..a5f17d6 100644 --- a/doc/POETRY.md +++ b/doc/POETRY.md @@ -1,17 +1,23 @@ # Poetry -## Add automatically dependencies + +## Add dependencies automatically + Add your dependencies in file [requirements.txt](../requirements.txt) and run script + ```bash ./script/poetry_update.py ``` + This will search all `requirements.txt` files and update `pyproject.toml` and it will update poetry Priority dependencies in ./requirements.txt, after it's ./odoo/requirements.txt, after it's highest version values. TODO add option to only add missing dependencies and ignore update. -## Add manually dependencies +## Add dependencies manually + The automatic script will erase this dependency, but you can add it for your local test. + ```bash poetry add PYTHON_MODULE ``` diff --git a/doc/PRODUCTION.md b/doc/PRODUCTION.md index c5971a3..7c9b85d 100644 --- a/doc/PRODUCTION.md +++ b/doc/PRODUCTION.md @@ -1,88 +1,129 @@ # ERPLibre production guide +## Requirement + +- 5Go of disk space + ## Production installation procedure ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git cd ERPLibre ``` ### 2. Modify the parameters -Modify the file env_var.sh for production installation. -### 3. Execute the script: +Modify the file env_var.sh for production installation. Enable nginx if you need a proxy with `EL_INSTALL_NGINX`. +Redirect your DNS to the proxy's ip and add your A and AAAA into `WL_WEBSITE_NAME` with space between. + +### 3. Execute the scripts: + +#### With proxy nginx production, install certbot before for SSL + +```bash +# Snap installation +# https://snapcraft.io/docs/installing-snap-on-debian +sudo apt install -y snapd +sudo snap install core +sudo snap refresh core + +# https://certbot.eff.org/lets-encrypt/debianbuster-nginx +# Cerbot +sudo snap install --classic certbot +sudo ln -s /snap/bin/certbot /usr/bin/certbot +``` + #### Ubuntu 18.04 server + ```bash ./script/install_dev.sh ./script/install_production.sh ``` -A service is running by systemd. You can access it with the DNS name found in env_var.sh + +A service is runned by SystemD. You can access it with the DNS name found in `env_var.sh` #### Ubuntu 20.04 server + Apply fix libpng12-0: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missing-in-ubuntu-1804.html ```bash ./script/install_dev.sh ./script/install_production.sh ``` -A service is running by systemd, you can access with the DNS name found in env_var.sh + +A service is runned by SystemD, you can access it with the DNS name found in `env_var.sh` ### 4. SSL: + Generate a ssl certificate + ```bash sudo certbot --nginx ``` ## Watch log + ```bash sudo systemctl -feu [EL_USER] ``` ## Run by address ip + Comment the following line in `/[EL_USER]/erplibre/config.conf` + ``` #xmlrpc_interface = 127.0.0.1 #netrpc_interface = 127.0.0.1 #proxy_mode = True ``` + Add your address ip server_name in nginx config `/etc/nginx/sites-available/[EL_WEBSITE_NAME]` Restart daemon: + ```bash sudo systemctl restart nginx sudo systemctl restart [EL_USER] ``` ## Production execution + ```bash cd /[EL_USER]/erplibre ./run.sh -d [DATABASE] --no-database-list ``` ## Move prod database to dev -When moving prod database to your dev environment, you want to remove email servers and install user test to test the database. -Warning, this is not safe for production, you expose all data. -Run: + +When moving prod database to your dev environment, you want to remove email servers and install user test to test the +database. WARNING, this is not safe for production, you will expose all data. Run: + ```bash ./script/migrate_prod_to_test.sh DATABASE ``` ## Update production + Update all features. + ```bash ./run.sh --limit-time-real 99999 --stop-after-init -u all -d DATABASE ``` # Postgresql -To show config file: + +To show config files: > psql -U postgres -c 'SHOW config_file' Edit this file to accept interface from all networks: > /var/lib/postgres/data/postgresql.conf # Delete an instance in production -Caution, this delete user's home, it's irrevocable. + +CAUTION, this will delete user's home, it's irrevocable. + ```bash ./script/delete_production.sh ``` @@ -94,6 +135,7 @@ mkdir ~/.cloudflare ``` Edit ~/.cloudflare/cloudflare.cfg + ``` [PROFILE_NAME] email=EMAIL @@ -101,6 +143,7 @@ token=TOKEN ``` Add your cron + ```bash vim /etc/crontab # Add @@ -108,6 +151,7 @@ vim /etc/crontab ``` Check log with + ```bash sudo journalctl -feu cron -``` \ No newline at end of file +``` diff --git a/doc/RELEASE.md b/doc/RELEASE.md index fc2983a..2606177 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -2,17 +2,16 @@ A guide on how to generate a release. -Before starting, validate [manifest/default.dev.xml](../manifest/default.dev.xml) is ready for production. +## Clean environment before generating new release -## Clean environment before generate new release +Before the cleaning, check if existing file isn't committed, not pushed or in stash. -Before clean, check if existing file not committed, not pushed or in stash. ```bash ./.venv/repo forall -pc "git stash list" ./script/git_show_code_diff_repo_manifest.py ``` -This will erase everything in addons. Useful before create docker, manifest and do a release. +This will erase everything in addons. Useful before creating docker, manifest and do a release. ```bash ./script/clean_repo_manifest.sh @@ -24,9 +23,56 @@ And update all from dev to merge into prod. ./script/install_locally_dev.sh ``` -## Update image_db +## Validate environment -Change all default image to improve speed when restoring database. Recreate it manually. Check directory `./image_db`. +- Check if [manifest/default.dev.xml](../manifest/default.dev.xml) is ready for production. +- Run test : + +```bash +make test +``` + +### Format code + +To format all code, run: + +```bash +make format +``` + +### Update image_db + +To generate database images in directory `./image_db`, run: + +```bash +make image_db_create_all +``` + +### Update documentations + +To generate Markdown in directory `./doc`, run: + +```bash +make doc_markdown +``` + +### Test docker generate + +To generate a docker, run: + +```bash +make docker_build +``` + +### Test production Ubuntu environment + +Follow instructions in [PRODUCTION.md](./PRODUCTION.md). + +Test installation with code generator Geomap: + +```bash +make addons_install_code_generator_full +``` ## Generate new prod and release @@ -39,11 +85,13 @@ Generate production manifest and freeze all repos versions. Update ERPLIBRE_VERSION variable in [env_var.sh](../env_var.sh) and [Dockerfile.prod](../docker/Dockerfile.prod.pkg). Generate [poetry](./POETRY.md) and keep only missing dependencies, remove updates. + ```bash ./script/poetry_update.py ``` When running script poetry_update.py, note manually inserted dependencies, stash all changes and add it manually. + ```bash poetry add DEPENDENCY ``` @@ -60,6 +108,7 @@ git diff v#.#.#..HEAD ``` Simplification tools: + ```bash # Show all divergence repository with production make repo_diff_manifest_production @@ -81,7 +130,7 @@ Review by your peers, test the docker file and merge to master. ## Generate image db to accelerate db installation -Generate image db before tag, the image is store in directory ./image_db +Generate image db before tag, the image is stored in directory ./image_db ```bash make image_db_create_all @@ -128,4 +177,4 @@ To generate a list of differences between repo git commit ```bash ./script/git_change_remote.py --sync_to /path/to/directory -``` \ No newline at end of file +``` diff --git a/doc/RUN.md b/doc/RUN.md index c2c71a6..7e74319 100644 --- a/doc/RUN.md +++ b/doc/RUN.md @@ -1,49 +1,65 @@ # Execute ERPLibre ## Start database + ```bash sudo systemctl start postgresql.service ``` ## Run ERPLibre + ### Method 1 + Simply + ```bash ./run.sh ``` With arguments + ```bash ./run.sh -h ``` ### Method 2 + Execute your own python script: + ```bash ./run.sh --log-level debug ``` ### Update all + Great idea to run it when updating Odoo, it updates each module database. + ```bash ./run.sh -d [DATABASE] -u all --log-level debug ``` ### Update module + ```bash ./run.sh -d [DATABASE] -u [module] --log-level debug ``` ### Test + First execution, install you requirements, choose a new database. + ```bash ./run.sh -d [DATABASE] -i [module to test] --test-enable --stop-after-init --log-level=test ``` + Execute your test on a specific module. + ```bash ./run.sh -d [DATABASE] -u [module to test] --test-enable --stop-after-init --log-level=test ``` + Execute your test on a specific module with tags. + ```bash ./run.sh -d [DATABASE] -u [module to test] --test-enable --stop-after-init --log-level=test --test-tags [module_name][tags] -``` \ No newline at end of file +``` diff --git a/doc/TODO.md b/doc/TODO.md index 5650e49..4ea07a8 100644 --- a/doc/TODO.md +++ b/doc/TODO.md @@ -1,11 +1,13 @@ # Note healtcheck + Table à vérifier dans pgsql: ir_ui_view Restore une BD: + - un module est installé mais n'est pas physiquement là Une DB est installé mais on n'arrive pas à l'exécuté - HEALTHCHECK CMD curl --fail http://localhost:8069/web || exit 1 +HEALTHCHECK CMD curl --fail http://localhost:8069/web || exit 1 - TODO: having the DB variable configurable \ No newline at end of file +TODO: having the DB variable configurable diff --git a/doc/UPDATE.md b/doc/UPDATE.md index 284be38..953ad05 100644 --- a/doc/UPDATE.md +++ b/doc/UPDATE.md @@ -1,20 +1,25 @@ # Update ERPLibre + ## Update all repos from the origin source + The update is possible on branch 12.0, you need to verify this branch existence. -1. Make sure all git repos are conform, remove all argument depth from manifest and regenerate. -You can clean all and regenerate. +1. Make sure all git repos are conform, remove all argument depth from manifest and regenerate. You can clean all and + regenerate. + ```bash ./script/clean_repo_manifest.sh ./script/install_locally_dev.sh ``` 2. Update all remote with ssh/git + ```bash ./script/git_change_remote_https_to_git.py ``` 3. Run update script + ```bash ./script/git_update_repo.py ``` diff --git a/docker/Dockerfile.prod.pkg b/docker/Dockerfile.prod.pkg index 9706f67..83319c8 100644 --- a/docker/Dockerfile.prod.pkg +++ b/docker/Dockerfile.prod.pkg @@ -1,4 +1,4 @@ -FROM technolibre/erplibre-base:1.1.1 +FROM technolibre/erplibre-base:1.2.0 ENV REPO_MANIFEST_URL https://github.com/ERPLibre/ERPLibre ARG WORKING_BRANCH diff --git a/env_var.sh b/env_var.sh index 6d58466..9e46884 100755 --- a/env_var.sh +++ b/env_var.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -ERPLIBRE_VERSION="1.1.1" +ERPLIBRE_VERSION="1.2.0" EL_USER="erplibre" EL_HOME="/${EL_USER}" @@ -19,7 +19,7 @@ EL_MINIMAL_ADDONS="False" # Set this to True if you want to install Nginx! EL_INSTALL_NGINX="True" # Set the website name -EL_WEBSITE_NAME="" +EL_WEBSITE_NAME="localhost" EL_GITHUB_TOKEN="" EL_MANIFEST_PROD="./default.xml" EL_MANIFEST_DEV="./manifest/default.dev.xml" diff --git a/manifest/default.dev.xml b/manifest/default.dev.xml index 0013b55..cfde160 100644 --- a/manifest/default.dev.xml +++ b/manifest/default.dev.xml @@ -51,7 +51,7 @@ - + @@ -65,12 +65,12 @@ - + - - + + @@ -93,14 +93,14 @@ - - + + - + @@ -111,7 +111,7 @@ - + @@ -151,6 +151,6 @@ - + diff --git a/script/csv/compare_database_application.py b/script/csv/compare_database_application.py index 15421a0..8828838 100755 --- a/script/csv/compare_database_application.py +++ b/script/csv/compare_database_application.py @@ -30,7 +30,11 @@ def get_config(): ) parser.add_argument("--csv_1", required=True, help="CSV file first") parser.add_argument("--csv_2", required=True, help="CSV file second") - parser.add_argument("--compare_key", required=True, help="Key to search and compare with it.") + parser.add_argument( + "--compare_key", + required=True, + help="Key to search and compare with it.", + ) args = parser.parse_args() return args @@ -38,8 +42,8 @@ def get_config(): def main(): config = get_config() - with open(config.csv_1, mode='r') as csv_file_1: - with open(config.csv_2, mode='r') as csv_file_2: + with open(config.csv_1, mode="r") as csv_file_1: + with open(config.csv_2, mode="r") as csv_file_2: csv_reader_1 = csv.DictReader(csv_file_1) csv_reader_2 = csv.DictReader(csv_file_2) lst_csv_1 = [a.get(config.compare_key) for a in csv_reader_1] diff --git a/script/docker/docker_build.sh b/script/docker/docker_build.sh index 283bf31..15e0499 100755 --- a/script/docker/docker_build.sh +++ b/script/docker/docker_build.sh @@ -29,7 +29,13 @@ ERPLIBRE_DOCKER_PROD_VERSION="${ERPLIBRE_DOCKER_PROD}:${ERPLIBRE_VERSION}" echo "Create docker ${ERPLIBRE_DOCKER_PROD_VERSION}" # Rewrite docker-compose -./script/docker_update_version.py --version=${ERPLIBRE_VERSION} --base=${ERPLIBRE_DOCKER_BASE} --prod=${ERPLIBRE_DOCKER_PROD} +./script/docker/docker_update_version.py --version=${ERPLIBRE_VERSION} --base=${ERPLIBRE_DOCKER_BASE} --prod=${ERPLIBRE_DOCKER_PROD} + +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "Error ./script/docker/docker_build.sh when execute docker_update_version.py" + exit 1 +fi cd docker diff --git a/script/docker/docker_update_version.py b/script/docker/docker_update_version.py index 56bb974..f62856f 100755 --- a/script/docker/docker_update_version.py +++ b/script/docker/docker_update_version.py @@ -5,7 +5,9 @@ import argparse import logging import yaml -new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) +new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") +) sys.path.append(new_path) from script.git_tool import GitTool diff --git a/script/git_tool.py b/script/git_tool.py index 296e25d..e43045a 100644 --- a/script/git_tool.py +++ b/script/git_tool.py @@ -394,7 +394,7 @@ class GitTool: if ( "addons/OCA_web" == repo.get("path") or "odoo" == repo.get("path") - or "ERPLibre_image_db" == repo.get("path") + or "image_db" == repo.get("path") ): continue str_repo = ( diff --git a/script/install_daemon.sh b/script/install_daemon.sh index 1255400..0b7b912 100755 --- a/script/install_daemon.sh +++ b/script/install_daemon.sh @@ -68,9 +68,12 @@ echo "User service: ${EL_USER}" echo "User PostgreSQL: ${EL_USER}" echo "Code location: ${EL_USER}" echo "Addons folder: ${EL_USER}/${EL_CONFIG}/addons/" +echo "SystemD file ERPLibre: /etc/systemd/system/${EL_CONFIG}.service" echo "Start ERPLibre service: sudo systemctl start ${EL_CONFIG}" echo "Stop ERPLibre service: sudo systemctl stop ${EL_CONFIG}" echo "Restart ERPLibre service: sudo systemctl restart ${EL_CONFIG}" +echo "Status ERPLibre service: sudo systemctl status ${EL_CONFIG}" +echo "Logs ERPLibre service: sudo journalctl -feu ${EL_CONFIG}" echo "-----------------------------------------------------------" echo -e "* Starting ERPLibre Service" diff --git a/script/install_debian_dependency.sh b/script/install_debian_dependency.sh index 0a29e00..9be9d8f 100755 --- a/script/install_debian_dependency.sh +++ b/script/install_debian_dependency.sh @@ -38,7 +38,7 @@ sudo apt-get upgrade -y # Install PostgreSQL Server #-------------------------------------------------- echo -e "\n---- Install PostgreSQL Server ----" -sudo apt-get install postgresql libpq-dev -y +sudo apt-get install postgresql libpq-dev postgis -y echo -e "\n---- Creating the ERPLibre PostgreSQL User ----" sudo su - postgres -c "createuser -s ${EL_USER}" 2> /dev/null || true diff --git a/script/install_locally.sh b/script/install_locally.sh index 3b20639..aa94b66 100755 --- a/script/install_locally.sh +++ b/script/install_locally.sh @@ -160,13 +160,15 @@ if [[ ${EL_MINIMAL_ADDONS} = "False" ]]; then fi printf "\n" >> ${EL_CONFIG_FILE} -printf "workers = 0\n" >> ${EL_CONFIG_FILE} printf "max_cron_threads = 2\n" >> ${EL_CONFIG_FILE} if [[ ${EL_INSTALL_NGINX} = "True" ]]; then + printf "workers = 2\n" >> ${EL_CONFIG_FILE} printf "xmlrpc_interface = 127.0.0.1\n" >> ${EL_CONFIG_FILE} printf "netrpc_interface = 127.0.0.1\n" >> ${EL_CONFIG_FILE} printf "proxy_mode = True\n" >> ${EL_CONFIG_FILE} +else + printf "workers = 0\n" >> ${EL_CONFIG_FILE} fi #echo -e "\n---- Install Odoo with addons module ----" diff --git a/script/install_production.sh b/script/install_production.sh index 3fb6eab..8f3d73e 100755 --- a/script/install_production.sh +++ b/script/install_production.sh @@ -2,8 +2,6 @@ . ./env_var.sh -./script/install_debian_dependency.sh - echo -e "\n---- Create ERPLIBRE system user ----" sudo adduser --system --quiet --shell=/bin/bash --home=/${EL_USER} --gecos 'ERPLIBRE' --group ${EL_USER} #The user should also be added to the sudo'ers group. diff --git a/script/install_production_nginx.sh b/script/install_production_nginx.sh index 84693ac..f38bcc8 100755 --- a/script/install_production_nginx.sh +++ b/script/install_production_nginx.sh @@ -2,12 +2,19 @@ . ./env_var.sh +TEMP_FILENAME_NGINX_AVAILABLE="localhost" +NEW_EL_WEBSITE_NAME="${EL_WEBSITE_NAME}" +if [[ -z "${EL_WEBSITE_NAME}" ]]; then + NEW_EL_WEBSITE_NAME=${TEMP_FILENAME_NGINX_AVAILABLE} +fi +TEMP_FILE_NGINX_AVAILABLE="/tmp/${TEMP_FILENAME_NGINX_AVAILABLE}" + #-------------------------------------------------- # Install Nginx if needed #-------------------------------------------------- if [ ${EL_INSTALL_NGINX} = "True" ]; then - echo -e "\n---- Installing and setting up Nginx ----" - cat < /tmp/nginx${EL_USER} + echo -e "\n---- Installing and setting up Nginx into ${TEMP_FILE_NGINX_AVAILABLE} ----" + cat <${TEMP_FILE_NGINX_AVAILABLE} upstream erplibre${EL_USER} { server 127.0.0.1:${EL_PORT}; } @@ -18,7 +25,7 @@ upstream erplibre${EL_USER}chat { server { listen 80; - server_name ${EL_WEBSITE_NAME}; + server_name ${NEW_EL_WEBSITE_NAME}; # Add Headers for erplibre proxy mode proxy_set_header X-Forwarded-Host \$host; @@ -80,11 +87,11 @@ server { } EOF - sudo mv -f /tmp/nginx${EL_USER} /etc/nginx/sites-available/${EL_WEBSITE_NAME} - sudo ln -fs /etc/nginx/sites-available/${EL_WEBSITE_NAME} /etc/nginx/sites-enabled/${EL_WEBSITE_NAME} + sudo mv -f ${TEMP_FILE_NGINX_AVAILABLE} /etc/nginx/sites-available/${NEW_EL_WEBSITE_NAME} + sudo ln -fs /etc/nginx/sites-available/${NEW_EL_WEBSITE_NAME} /etc/nginx/sites-enabled/${NEW_EL_WEBSITE_NAME} sudo rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default sudo systemctl restart nginx - echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-enabled/${EL_WEBSITE_NAME}" + echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-enabled/${NEW_EL_WEBSITE_NAME}" echo "Run manually certbot : sudo certbot --nginx" else echo "Nginx isn't installed due to choice of the user!" diff --git a/script/manifest/compare_backup.py b/script/manifest/compare_backup.py index e62a853..5eb343b 100755 --- a/script/manifest/compare_backup.py +++ b/script/manifest/compare_backup.py @@ -37,14 +37,22 @@ def get_config(): parser.add_argument("--backup_2", help="Backup name second") args = parser.parse_args() - die(bool(args.backup_file_1) and bool(args.backup_1), - "Take only --backup_file_1 or --backup_1") - die(not bool(args.backup_file_1) and not bool(args.backup_1), - "Missing --backup_file_1 or --backup_1") - die(bool(args.backup_file_2) and bool(args.backup_2), - "Take only --backup_file_2 or --backup_2") - die(not bool(args.backup_file_2) and not bool(args.backup_2), - "Missing --backup_file_2 or --backup_2") + die( + bool(args.backup_file_1) and bool(args.backup_1), + "Take only --backup_file_1 or --backup_1", + ) + die( + not bool(args.backup_file_1) and not bool(args.backup_1), + "Missing --backup_file_1 or --backup_1", + ) + die( + bool(args.backup_file_2) and bool(args.backup_2), + "Take only --backup_file_2 or --backup_2", + ) + die( + not bool(args.backup_file_2) and not bool(args.backup_2), + "Missing --backup_file_2 or --backup_2", + ) return args @@ -61,11 +69,11 @@ def main(): file_path_2 = config.backup_file_2 else: file_path_2 = os.path.join("image_db", f"{config.backup_2}.zip") - - with zipfile.ZipFile(file_path_1, 'r') as zip_ref: + + with zipfile.ZipFile(file_path_1, "r") as zip_ref: manifest_file_1 = zip_ref.open("manifest.json") - with zipfile.ZipFile(file_path_2, 'r') as zip_ref: + with zipfile.ZipFile(file_path_2, "r") as zip_ref: manifest_file_2 = zip_ref.open("manifest.json") json_manifest_file_1 = json.load(manifest_file_1) @@ -81,10 +89,16 @@ def main(): print(f"{len(same)} same") if same: print(same) - print(f"{Fore.BLUE}{len(difference_1)}{Style.RESET_ALL} difference manifest 1 to manifest 2") + print( + f"{Fore.BLUE}{len(difference_1)}{Style.RESET_ALL} difference manifest" + " 1 to manifest 2" + ) if difference_1: print(difference_1) - print(f"{Fore.MAGENTA}{len(difference_2)}{Style.RESET_ALL} difference manifest 2 to manifest 1") + print( + f"{Fore.MAGENTA}{len(difference_2)}{Style.RESET_ALL} difference" + " manifest 2 to manifest 1" + ) if difference_2: print(difference_2)