diff --git a/.dev/dev.py b/.dev/dev.py index 5585171..aed041f 100755 --- a/.dev/dev.py +++ b/.dev/dev.py @@ -8,29 +8,42 @@ import inotify.adapters logging.basicConfig(level=logging.INFO, stream=sys.stderr) -SRC = os.environ['SRC'] -MODULE_NAME = os.environ['MODULE_NAME'] +SRC = os.environ['SRC'] + '/modules/' +MODULES = os.environ['MODULES'].split(':') DB_NAME = os.environ['DB_NAME'] + def _main(): i = inotify.adapters.Inotify() - - i.add_watch(SRC) logging.info("MONITOREANDO ARCHIVOS EN %s", SRC) + for module in MODULES: + i.add_watch( + SRC + module) + for event in i.event_gen(yield_nones=False): (_, type_names, path, filename) = event (_, ext) = os.path.splitext(filename) + if 'IN_CLOSE_WRITE' not in type_names: continue + module_name = path.split('/')[-1] + logging.info('NOMBRE DEL MODULO %s', module_name) + if ext in ['.py', '.xml', '.cfg']: for _ in range(0, 10): - if os.system("trytond-admin -d {} -u {}".format(DB_NAME, MODULE_NAME)) != 0: + command = "trytond-admin -d {} -u {} --act -vv".format( + DB_NAME, module_name) + logging.debug("Ejecutando comando: %s", command) + update_module = os.system(command) + if update_module != 0: time.sleep(2) logging.error("fallo trytond-admin") else: - logging.info("ACTUALIZADO TRYTOND POR CAMBIO DE ARCHIVO %s", filename) + logging.info( + "ACTUALIZADO TRYTOND POR CAMBIO DE ARCHIVO %s", + filename) break diff --git a/.dev/install_module.sh b/.dev/install_module.sh index e4a98e8..8ad6569 100644 --- a/.dev/install_module.sh +++ b/.dev/install_module.sh @@ -7,8 +7,11 @@ [ ! -d "$SRC" ] && die "no se ubica ruta en SRC" # dependencias minimas -pip3 install psycopg2 proteus==7.0.0 inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2 -pip3 install trytond-party trytond-company trytond-product trytond-product_image trytond-currency trytond-notification_email +pip3 install psycopg2 proteus==6.8.0 inotify honcho qrcode==6.1 pyshp==2.3.1 shapely==2.0.2 numpy==1.26.4 +pip3 install git+https://rodia:3sh0r4d3s3gu1r@gitea.onecluster.org/OneTeam/oc-facho.git@MigrationPython312Test +pip3 install trytond==6.8.0 trytond-party==6.8.0 trytond-company==6.8.0 trytond-product==6.8.0 trytond-product_image==6.8.0 trytond-currency==6.8.0 trytond-notification_email==6.8.0 trytond-purchase==6.8.0 trytond-sale_price_list==6.8.0 + +module_names=() for module in modules/*/; do @@ -23,6 +26,10 @@ for module in modules/*/; do # instalar modulo trytond_modules_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond/modules module_name=`cat "setup.py" | fgrep -A 1 [trytond.modules] | sed 1d | cut -d '=' -f 1 | tr -d ' \n'` + + # Añadir el nombre del módulo al arreglo + module_names+=("$module_name") + [ ! -d "$trytond_modules_path" ] && die "fallo al ubicar ruta de modulos de trytond" ln -sf "$SRC/$module" "$trytond_modules_path/$module_name" rm -rf "$SRC/$module/$module_name" @@ -33,6 +40,9 @@ done trytond_path=`pip3 show trytond | grep Location | sed -nr 's/Location: +//gp'`/trytond +module_names=$(IFS=:; echo "${module_names[*]}") + + if [ -d "locale_custom" ]; then cp -f "locale_custom/ir/pt.po" "$trytond_path/ir/locale/" fi diff --git a/.dev/run.sh b/.dev/run.sh index e8faebe..13f3f5f 100755 --- a/.dev/run.sh +++ b/.dev/run.sh @@ -24,7 +24,7 @@ yes admin | trytond-admin -d ${DB_NAME} --all --act # ejecutar servidor export SCRIPT_DIR -export MODULE_NAME=$module_name +export MODULES=$module_names export DB_NAME export SRC diff --git a/.dev/trytond.cfg b/.dev/trytond.cfg index c30c741..7a3d0bf 100755 --- a/.dev/trytond.cfg +++ b/.dev/trytond.cfg @@ -1,3 +1,8 @@ [web] listen = 0.0.0.0:8000 -root=/var/lib/trytond/www \ No newline at end of file +root=/var/lib/trytond/www + +[email] +uri = smtps+ssl://alnus@onecluster.org:"F:$VXa4`<~W!~y}@mail.onecluster.org:465 +from = alnus@onecluster.org + diff --git a/7.0/requirements_OneTeam.txt b/7.0/requirements_OneTeam.txt deleted file mode 100644 index 7b36617..0000000 --- a/7.0/requirements_OneTeam.txt +++ /dev/null @@ -1,108 +0,0 @@ -argcomplete==2.0.0 -argon2-cffi==21.1.0 -asttokens==2.2.1 -attrs==22.2.0 -backcall==0.2.0 -bcrypt==3.2.2 -beautifulsoup4==4.11.2 -braintree==4.24.0 -cached-property==1.5.2 -certifi==2022.9.24 -cffi==1.15.1 -chardet==5.1.0 -charset-normalizer==3.0.1 -click==8.1.3 -colorama==0.4.6 -cryptography==41.0.5 -csb43==0.9.2 -decorator==5.1.1 -defusedxml==0.7.1 -efficient-apriori==2.0.3 -elastic-transport==8.10.0 -elasticsearch==8.11.0 -elementpath==4.1.5 -executing==1.2.0 -febelfin-coda==0.2.0 -freezegun==1.2.1 -Genshi==0.7.7 -gevent==22.10.2 -greenlet==2.0.2 -gunicorn==20.1.0 -html2text==2020.1.16 -httplib2==0.20.4 -idna==3.3 -importlib-metadata==6.8.0 -ipython==8.5.0 -iso3166==2.1.1 -isodate==0.6.1 -jedi==0.18.2 -ldap3==2.9.1 -lxml==4.9.2 -MarkupSafe==2.1.2 -matplotlib-inline==0.1.6 -mt940==0.6.0 -oauthlib==3.2.2 -ofxparse==0.21 -parso==0.8.3 -passlib==1.7.4 -pexpect==4.8.0 -phonenumbers==8.13.26 -pickleshare==0.7.5 -Pillow==9.4.0 -platformdirs==2.6.0 -ply==3.11 -polib==1.1.1 -prompt-toolkit==3.0.36 -proteus==7.0.0 -psycopg2==2.9.5 -ptyprocess==0.7.0 -pure-eval==0.0.0 -pyactiveresource==2.2.2 -pyasn1==0.4.8 -pycountry==22.3.5 -pycparser==2.21 -pycurl==7.45.2 -pydot==1.4.2 -pygal==3.0.4 -Pygments==2.14.0 -PyJWT==2.8.0 -pyOpenSSL==23.3.0 -pyparsing==3.0.9 -pypdf==3.4.1 -pypng==0.20220715.0 -pysaml2==7.4.2 -PySimpleSOAP==1.16.2 -python-barcode==0.15.1 -python-dateutil==2.8.2 -python-Levenshtein==0.12.2 -python-magic==0.4.26 -python-sql==1.4.2 -python-stdnum==1.19 -pytz==2022.7.1 -PyYAML==6.0 -qrcode==7.4.2 -relatorio==0.10.1 -requests==2.28.1 -requests-file==1.5.1 -requests-oauthlib==1.3.1 -requests-toolbelt==0.10.1 -schwifty==2023.11.0 -ShopifyAPI==12.3.0 -simpleeval==0.9.12 -six==1.16.0 -soupsieve==2.3.2 -stack-data==0.6.2 -stripe==7.6.0 -traitlets==5.5.0 -typing_extensions==4.8.0 -urllib3==1.26.12 -wcwidth==0.2.5 -webcolors==1.13 -Werkzeug==2.2.2 -wrapt==1.14.1 -xmlschema==2.5.0 -zeep==4.2.1 -zipp==3.17.0 -zope.event==4.4 -zope.interface==5.5.2 -tabulate==0.9.0 diff --git a/Dockerfile b/Dockerfile index 4715d0f..3c77a74 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,97 +1,18 @@ +# https://foss.heptapod.net/tryton/tryton-docker/-/blob/branch/default/6.8/Dockerfile FROM node as builder-node + ENV SERIES 6.8 RUN npm install -g bower -RUN curl -L https://downloads.tryton.org/${SERIES}/tryton-sao-last.tgz | tar zxf - -C / +RUN curl https://downloads.tryton.org/${SERIES}/tryton-sao-last.tgz | tar zxf - -C / RUN cd /package && bower install --allow-root -FROM debian:11-slim -LABEL maintainer="Tryton " \ - org.label-schema.name="Tryton" \ - org.label-schema.url="http://www.tryton.org/" \ - org.label-schema.vendor="Tryton" \ - org.label-schema.version="6.8" \ - org.label-schema.schema-version="1.0" - -ENV SERIES 6.8 -ENV LANG C.UTF-8 +FROM python:3.11-bullseye -RUN groupadd -r trytond \ - && useradd --no-log-init -r -d /var/lib/trytond -m -g trytond trytond \ - && mkdir /var/lib/trytond/db && chown trytond:trytond /var/lib/trytond/db \ - && mkdir /var/lib/trytond/www \ - && mkdir -p /etc/python3 \ - && echo "[DEFAULT]\nbyte-compile = standard, optimize" \ - > /etc/python3/debian_config - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - curl \ - python3 \ - python3-pip \ - python3-setuptools \ - python3-wheel \ - uwsgi \ - uwsgi-plugin-python3 \ - python3-argcomplete \ - # trytond - python3-argon2 \ - python3-bcrypt \ - python3-cffi \ - python3-genshi \ - python3-gevent \ - python3-html2text \ - python3-pil \ - python3-levenshtein \ - python3-lxml \ - python3-passlib \ - python3-polib \ - python3-psycopg2 \ - python3-pydot \ - python3-werkzeug \ - python3-wrapt \ - # modules - python3-dateutil \ - python3-ldap3 \ - python3-magic \ - python3-ofxparse \ - python3-pypdf2 \ - python3-pysimplesoap \ - python3-requests \ - python3-simpleeval \ - python3-tz \ - python3-yaml \ - python3-zeep \ - weasyprint \ - libpango-1.0-0 \ - libpangoft2-1.0-0 \ - && rm -rf /var/lib/apt/lists/* - -RUN pip3 install --no-cache-dir \ - "trytond == ${SERIES}.*" \ - "proteus == ${SERIES}.*" \ - && for module in `curl -L https://downloads.tryton.org/${SERIES}/modules.txt`; do \ - pip3 install --no-cache-dir "trytond_${module} == ${SERIES}.*" || exit 1; \ - done \ - && pip3 install --no-cache-dir \ - python-barcode[images] \ - qrcode[pil] \ - webcolors \ - phonenumbers \ - pycountry \ - pygal \ - python-stdnum[SOAP] \ - schwifty \ - && python3 -c "import compileall; compileall.compile_path(maxlevels=10, optimize=1)" +# trytond DB_CACHE requiere commandos `pg_dump` y `pg_restore` +RUN apt-get update && apt-get install -y postgresql-client +# TOMADO DE: https://hg.tryton.org/tryton-docker/file/tip/6.6/Dockerfile COPY --from=builder-node /package /var/lib/trytond/www -COPY entrypoint.sh / -COPY trytond.conf /etc/trytond.conf -COPY uwsgi.conf /etc/uwsgi.conf -EXPOSE 8000 - -VOLUME ["/var/lib/trytond/db"] -ENV TRYTOND_CONFIG=/etc/trytond.conf -USER trytond -ENTRYPOINT ["/entrypoint.sh"] -CMD ["uwsgi", "--ini", "/etc/uwsgi.conf"] \ No newline at end of file +# Copy Sao Personalization +# COPY sao_custom/ /var/lib/trytond/www/ diff --git a/Dockerfile_test b/Dockerfile_test index 7931d5a..cd83991 100644 --- a/Dockerfile_test +++ b/Dockerfile_test @@ -1,15 +1,5 @@ # TOMADO DE: https://hg.tryton.org/tryton-docker/file/tip/6.6/Dockerfile -FROM node as builder-node - -ENV SERIES 7.0 -RUN npm install -g bower -RUN curl https://downloads.tryton.org/${SERIES}/tryton-sao-last.tgz | tar zxf - -C / -RUN cd /package && bower install --allow-root - FROM python:3.11-bullseye # trytond DB_CACHE requiere commandos `pg_dump` y `pg_restore` RUN apt-get update && apt-get install -y postgresql-client - -# TOMADO DE: https://hg.tryton.org/tryton-docker/file/tip/6.6/Dockerfile -COPY --from=builder-node /package /var/lib/trytond/www \ No newline at end of file diff --git a/Rakefile b/Rakefile index 15edaa9..02d4981 100755 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,7 @@ end desc 'poblar entorno' task :init => [:up] do - compose('exec', 'test.dev', 'pip3 install psycopg2 flake8 trytond==7.0.0') + compose('exec', 'test.dev', 'pip3 install psycopg2 flake8 trytond==6.8.0') compose('exec', 'test.dev', "bash .dev/install_module.sh") end diff --git a/compose.live.yml b/compose.live.yml index 474d618..86fb343 100755 --- a/compose.live.yml +++ b/compose.live.yml @@ -21,5 +21,5 @@ services: ports: - "${TRYTON_PORT_LIVE:-28000}:8000" working_dir: /app - env_file: - - .env + # env_file: + # - .env diff --git a/sets/modules.txt b/sets/modules.txt index a953563..ff0ec19 100644 --- a/sets/modules.txt +++ b/sets/modules.txt @@ -1,9 +1,14 @@ account_co_co account_co_pyme account_co_reports +account_exo account_invoice_facho account_invoice_subtype account_stock_continental purchase +purchase_facho sale +sale_price_list +sale_shop +sale_facho notification_email