Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix10 #15

Open
wants to merge 11 commits into
base: 10.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "prescrypto/campos_clientes_vittal"]
path = prescrypto/campos_clientes_vittal
url = https://github.com/Prescrypto/campos-clientes-vittal
87 changes: 87 additions & 0 deletions DEmo_Dockerfile_v13.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FROM debian:buster-slim
MAINTAINER Odoo S.A. <[email protected]>

SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

# Generate locale C.UTF-8 for postgres and general locale data
ENV LANG C.UTF-8

# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dirmngr \
fonts-noto-cjk \
gnupg \
libssl-dev \
node-less \
npm \
python3-num2words \
python3-pip \
python3-phonenumbers \
python3-pyldap \
python3-qrcode \
python3-renderpm \
python3-setuptools \
python3-slugify \
python3-vobject \
python3-watchdog \
python3-xlrd \
python3-xlwt \
xz-utils \
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
&& echo 'ea8277df4297afc507c61122f3c349af142f31e5 wkhtmltox.deb' | sha1sum -c - \
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb

# install latest postgresql-client
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
&& GNUPGHOME="$(mktemp -d)" \
&& export GNUPGHOME \
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
&& gpgconf --kill all \
&& rm -rf "$GNUPGHOME" \
&& apt-get update \
&& apt-get install --no-install-recommends -y postgresql-client \
&& rm -f /etc/apt/sources.list.d/pgdg.list \
&& rm -rf /var/lib/apt/lists/*

# Install rtlcss (on Debian buster)
RUN npm install -g rtlcss

# Install Odoo
ENV ODOO_VERSION 13.0
ARG ODOO_RELEASE=20220401
ARG ODOO_SHA=2af3333f6048663e921ea49d7dc836d4dcf31cb4
RUN curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
&& echo "${ODOO_SHA} odoo.deb" | sha1sum -c - \
&& apt-get update \
&& apt-get -y install --no-install-recommends ./odoo.deb \
&& rm -rf /var/lib/apt/lists/* odoo.deb

# Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/

# Set permissions and Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
RUN chown odoo /etc/odoo/odoo.conf \
&& mkdir -p /mnt/extra-addons \
&& chown -R odoo /mnt/extra-addons
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]

# Expose Odoo services
EXPOSE 8069 8071 8072

# Set the default config file
ENV ODOO_RC /etc/odoo/odoo.conf

COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py

# Set default user when running the container
USER odoo

ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
54 changes: 46 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
FROM debian:jessie
#FROM debian:jessie
#FROM scratch
#ADD ubuntu-bionic-oci-amd64-root.tar.gz /
FROM ubuntu:18.04
MAINTAINER Prescrypto

# Install python build dependencies
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
openssh-server \
iproute2 \
ca-certificates \
curl \
node-less \
python-gevent \
python-pip \
python-renderpm \
python-support \
python-watchdog \
python-dev \
python-setuptools \
libpq-dev \
build-essential \
libxml2-dev \
Expand All @@ -24,12 +30,26 @@ RUN set -x; \
libldap2-dev \
libjpeg-dev \
libz-dev \
&& curl -o wkhtmltox.deb -SL http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb \
&& echo '40e8b906de658a2221b15e4e8cd82565a47d7ee8 wkhtmltox.deb' | sha1sum -c - \
&& dpkg --force-depends -i wkhtmltox.deb \
wget \
fontconfig \
fontconfig-config \
fonts-dejavu-core \
libfontconfig1 \
libfontenc1 \
libjpeg-turbo8 \
libxrender1 \
x11-common \
xfonts-75dpi \
xfonts-base \
xfonts-encodings \
xfonts-utils \
libxext6 \
nano \
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb \
&& dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb \
&& apt --fix-broken install \
&& apt-get -y install -f --no-install-recommends \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false npm \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb \
&& pip install psycogreen==1.0

# Add group
Expand All @@ -46,6 +66,12 @@ COPY ./odoo.conf /etc/odoo/
COPY ./requirements.txt /
RUN chown odoo /etc/odoo/odoo.conf

# Copy entrypoint script
COPY ./entrypoint.sh /
RUN chown odoo entrypoint.sh
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
RUN chown odoo /usr/local/bin/wait-for-psql.py

# Add python dependencies
RUN pip install -r requirements.txt # Mount /mnt/prescrypto-odoo for our fork and /mnt/custom-addons for Prescrypto addons
RUN mkdir -p /mnt/prescrypto-odoo \
Expand All @@ -57,7 +83,11 @@ RUN mkdir -p /mnt/custom-addons \
RUN mkdir -p /mnt/extra-addons \
&& chown -R odoo /mnt/extra-addons

VOLUME ["/var/lib/odoo", "/mnt/prescrypto-odoo", "/mnt/extra-addons", "/mnt/custom-addons"]
RUN mkdir /odoo \
&& chown -R odoo /odoo
#COPY . /odoo

VOLUME ["/var/lib/odoo", "/mnt/prescrypto-odoo", "/mnt/extra-addons", "/mnt/custom-addons", "/odoo"]

# Expose Odoo services
EXPOSE 8069 8071
Expand All @@ -68,4 +98,12 @@ ENV ODOO_RC /etc/odoo/odoo.conf
# Set default user when running the container
USER odoo

ENTRYPOINT ["/bin/bash"]
ADD ./.profile.d /app/.profile.d
#RUN rm /bin/sh && ln -s /bin/bash /bin/sh
#RUN rm /bin/sh \
# && ln -s /bin/bash /bin/sh

#ENTRYPOINT ["/entrypoint.sh"]
#ENTRYPOINT ["/bin/sh"]
#CMD ["odoo"]

4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ services:
- ./addons:/mnt/extra-addons
- ./prescrypto:/mnt/custom-addons
- ./output:/var/lib/odoo
- ./:/odoo
env_file: ./.env_variables
db:
image: postgres:9.4
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
- POSTGRES_DB=postgres
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
- '5432:5432'
volumes:
- pgdata:/var/lib/postgresql/data/pgdata
pgadmin:
Expand Down
56 changes: 56 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -e

if [ -v PASSWORD_FILE ]; then
PASSWORD="$(< $PASSWORD_FILE)"
fi

# set the postgres database host, port, user and password according to the environment
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${DB_PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${DB_NAME:=${DB_ENV_DB_NAME:='postgres'}}
#: ${DB_SSLMODE:=${DB_ENV_DB_SSLMODE:='allow'}}

DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}
check_config "db_host" "$HOST"
check_config "db_port" "$DB_PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"
check_config "database" "$DB_NAME"
#check_config "db_sslmode" "$DB_SSLMODE"


case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec /odoo/oodoo-bin "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
#exec ./odoo/odoo-bin --database='$DB_ENV_DB_NAME' --db_user='$DB_ENV_POSTGRES_USER' --db_password='$DB_ENV_POSTGRES_PASSWORD' --db_host='$DB_PORT_5432_TCP_ADDR' --db_port='$DB_PORT_5432_TCP_ADDR'
#exec ./odoo/odoo-bin "$@" "${DB_ARGS[@]}"
exec /odoo/odoo-bin --database=${DB_ENV_DB_NAME} --db_user=${DB_ENV_POSTGRES_USER} --db_password=${DB_ENV_POSTGRES_PASSWORD} --db_host=${DB_PORT_5432_TCP_ADDR} --db_port=${DB_PORT_5432_TCP_PORT} --dev='all'
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec /odoo/odoo-bin "$@" "${DB_ARGS[@]}"
;;
*)
exec "$@"
esac

exit 1
57 changes: 57 additions & 0 deletions entrypoint_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -e

if [ -v PASSWORD_FILE ]; then
PASSWORD="$(< $PASSWORD_FILE)"
fi

# set the postgres database host, port, user and password according to the environment
# and pass them as arguments to the odoo process if not present in the config file
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
: ${DB_PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
: ${DB_NAME:=${DB_ENV_DB_NAME:='d6bt7m2idt805l'}}
#: ${DB_SSLMODE:=${DB_ENV_DB_SSLMODE:='allow'}}

DB_ARGS=()
function check_config() {
param="$1"
value="$2"
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
fi;
DB_ARGS+=("--${param}")
DB_ARGS+=("${value}")
}
check_config "db_host" "$HOST"
check_config "db_port" "$DB_PORT"
check_config "db_user" "$USER"
check_config "db_password" "$PASSWORD"
check_config "database" "$DB_NAME"
#check_config "db_sslmode" "$DB_SSLMODE"

echo ${DB_ARGS[@]}

case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec ./odoo/oodoo-bin "$@"
echo "SCAFFOLD"
else
#wait-for-psql.py ${DB_ARGS[@]} --timeout=30
#exec ./odoo/odoo-bin "$@" "${DB_ARGS[@]}"
exec /odoo/odoo-bin --database=${DB_ENV_DB_NAME} --db_user=${DB_ENV_POSTGRES_USER} --db_password=${DB_ENV_POSTGRES_PASSWORD} --db_host=${DB_PORT_5432_TCP_ADDR} --db_port=${DB_PORT_5432_TCP_PORT} --dev='all'
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec /odoo/odoo-bin "$@" "${DB_ARGS[@]}"
;;
*)
exec "$@"
esac

exit 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add EOF line

24 changes: 24 additions & 0 deletions full_cfdi_request.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:scfd="http://namespace.pegasotecnologia.com/SCFD" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<scfd:emitirCFD>
<scfd:PoRequestCFD>
<RequestCFD version="3.3">
<Comprobante Version="3.3" Serie="INV" Folio="20210002" Fecha="2021-03-05T19:47:38" FormaPago="99" SubTotal="2000" Moneda="MXN" Total="2000" TipoDeComprobante="I" MetodoPago="PPD" LugarExpedicion="15900">
<Emisor Rfc="TMO1104114Y9" Nombre="TIEMPOREAL_TMO1104114Y9_ws" RegimenFiscal="601"/>
<Receptor Rfc="VIS1504019A8" Nombre="Visoñe S.A. de C.V" UsoCFDI="G03"/>
<Conceptos>
<Concepto ClaveProdServ="85121800" Cantidad="1" ClaveUnidad="E48" Unidad="1" Descripcion="[Areaprotegida1] Area Protegida" ValorUnitario="2000" Importe="2000"/>
</Conceptos>
</Comprobante>
<Transaccion id="2021-03-05T19:47:38INV20210002"/>
<TipoComprobante clave="Factura" nombre="Factura"/>
<Sucursal nombre="MATRIZ"/>
<Receptor emailReceptor="[email protected];[email protected]"/>
</RequestCFD>

</scfd:PoRequestCFD>
</scfd:emitirCFD>
</soapenv:Body>
</soapenv:Envelope>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add EOF line

6 changes: 5 additions & 1 deletion odoo.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[options]
addons_path = /mnt/extra-addons,/mnt/custom-addons
addons_path = /mnt/extra-addons,/mnt/custom-addons,/mnt/prescrypto-odoo/prescrypto/campos_clientes_vittal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien!

data_dir = /var/lib/odoo
; db_sslmode = require
; db_name = d6bt7m2idt805l

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estos quedan fijos?

; log_level = debug
; dbfilter = d6bt7m2idt805l
; admin_passwd = admin
; csv_internal_sep = ,
; db_maxconn = 64
Expand Down
1 change: 1 addition & 0 deletions odoo/sql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def borrow(self, connection_info):
raise PoolError('The Connection Pool Is Full')

try:
print("JMRM connection info: {}".format(connection_info))
result = psycopg2.connect(
connection_factory=PsycoConnection,
**connection_info)
Expand Down
16 changes: 0 additions & 16 deletions prescrypto/README.md

This file was deleted.

Loading