-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
PyXB 1.2.6 + Python 3.8: TypeError: function takes 3 arguments plus optional tzinfo (8 given) #1848
Comments
Dovresti verificare la tua installazione oppure dare maggiori dettagli su come riprodurre il problema (dalla descrizione sembra che qualunque fattura non possa essere esportata, cosa impossibile visto ogni giorno vengono generate migliaia di fatture con |
Ciao, ho reinstallato tutto usando python3.7 e ha funzionato correttamente. Ne deduco che - come anche suggerito nel forum - il problema nasce da pyxb con python 3.8 |
@d4rkstar grazie, tengo aperta la segnalazione perchè è un problema da analizzare |
Ciao @eLBati , nel weekend provo a rifare di nuovo la stessa installazione con python 3.8 e ti do un ulteriore riscontro. La mia installazione è su ubuntu 20.04 lts e ho usato sinora python 3.8 di sistema. Per usare python 3.7 ho compilato da sorgenti ufficiali (Python 3.7.9) e poi ho creato virtualenv. Conto di ripetere sia con 3.8 di sistema che con 3.8 da sorgenti. |
Ciao @eLBati , ho rimesso la 3.8 e l'errore si è ripresentato. Sembra sia correlato a questo: pabigot/pyxb#123 Che ne pensi? |
Tenderei a confermare che il bug sia relativo alla compatibilita' tra pyxb e python3.8 (o ad eventuale uso specifico di pyxb da parte di questi moduli). Riproducibilita'Non riesco a pensare un modo per mandare velocemente la configurazione di Odoo (configurazione azienda, fattura pa ecc...), ma di seguito un Dockerfile di testing basato sull'official di Odoo e modificato (velocemente) per installare i moduli di questo repository. Basato su ubuntu 20.04 con Python3.8, all'esportazione dall'e-invoice riporta l'errore di questo issue. Modificato il Dockerfile per estendere da python:3.7-buster, l'esportazione della fattura elettronica funziona out-of-the-box. Dockerfile (Python3.8@Ubuntu20.04)
FROM ubuntu:20.04
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 \
node-less \
python3-num2words \
python3-pip \
python3-phonenumbers \
python3-pyldap \
libldap2-dev \
libsasl2-dev \
python3-qrcode \
python3-renderpm \
python3-setuptools \
python3-slugify \
python3-vobject \
python3-watchdog \
python3-xlrd \
python3-xlwt \
python3-venv \
xz-utils
RUN curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb\
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
# Install rtlcss
RUN echo "deb http://deb.nodesource.com/node_8.x eoan main" > /etc/apt/sources.list.d/nodesource.list \
&& GNUPGHOME="$(mktemp -d)" \
&& export GNUPGHOME \
&& repokey='9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280' \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
&& gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/nodejs.gpg.asc \
&& gpgconf --kill all \
&& rm -rf "$GNUPGHOME" \
&& apt-get update \
&& apt-get install --no-install-recommends -y nodejs npm \
&& npm install -g rtlcss \
&& rm -rf /var/lib/apt/lists/*
# Install Odoo
RUN apt-get update && apt-get -y install libpq-dev python3-dev build-essential python3-psycopg2
RUN pip3 install http://nightly.odoo.com/12.0/nightly/src/odoo_12.0.latest.tar.gz
RUN pip3 uninstall -y Wekzeug && pip3 install Werkzeug==0.11.15
RUN pip3 install --pre odoo12-addon-l10n-it-abicab \
odoo12-addon-l10n-it-ddt \
odoo12-addon-l10n-it-account \
odoo12-addon-l10n-it-ipa \
odoo12-addon-l10n-it-corrispettivi \
odoo12-addon-l10n-it-rea \
odoo12-addon-l10n-it-fatturapa \
odoo12-addon-l10n-it-fiscalcode \
odoo12-addon-l10n-it-intrastat \
odoo12-addon-l10n-it-ateco \
odoo12-addon-l10n-it-pec \
odoo12-addon-l10n-it-location-nuts \
odoo12-addon-l10n-it-fiscalcode-crm \
odoo12-addon-l10n-it-fatturapa-pec \
odoo12-addon-l10n-it-causali-pagamento \
odoo12-addon-l10n-it-codici-carica \
odoo12-addon-l10n-it-sdi-channel \
odoo12-addon-l10n-it-account-stamp \
odoo12-addon-l10n-it-fatturapa-in \
odoo12-addon-l10n-it-esigibilita-iva \
odoo12-addon-l10n-it-delivery-note \
odoo12-addon-l10n-it-pos-fatturapa \
odoo12-addon-l10n-it-intrastat-statement \
odoo12-addon-l10n-it-fatturapa-sale \
odoo12-addon-l10n-it-fatturapa-out \
odoo12-addon-l10n-it-corrispettivi-sale \
odoo12-addon-l10n-it-dichiarazione-intento \
odoo12-addon-l10n-it-ricevute-bancarie \
odoo12-addon-l10n-it-vat-registries \
odoo12-addon-l10n-it-fiscalcode-sale \
odoo12-addon-l10n-it-withholding-tax \
odoo12-addon-l10n-it-pos-fiscalcode \
odoo12-addon-l10n-it-reverse-charge \
odoo12-addon-l10n-it-split-payment \
odoo12-addon-l10n-it-central-journal
# Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/
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
ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
Patch Dockerfile (Python3.7@DebianBuster)
diff --git 12.0/Dockerfile 12.0/Dockerfile
index c2eca5d..4a6b8dc 100644
--- 12.0/Dockerfile
+++ 12.0/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:20.04
+FROM python:3.7-buster
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
@@ -31,12 +31,12 @@ RUN apt-get update \
python3-venv \
xz-utils
-RUN curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb\
+RUN curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb\
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
# Install rtlcss
-RUN echo "deb http://deb.nodesource.com/node_8.x eoan main" > /etc/apt/sources.list.d/nodesource.list \
+RUN echo "deb http://deb.nodesource.com/node_8.x buster main" > /etc/apt/sources.list.d/nodesource.list \
&& GNUPGHOME="$(mktemp -d)" \
&& export GNUPGHOME \
&& repokey='9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280' \
|
@aleskandro grazie mille. Considerate anche che si stanno facendo dei lavori per liberarsi di PyXB, vedi ad esempio #1925 Questi lavori sono relativi al porting a odoo 14, ma potrebbero anche essere portati alle versioni precedenti. In questo periodo, il venerdì facciamo una sorta di sprint online. Se voleste partecipare ci trovate sul server discord Odoo Italia |
Buongiorno, grazie a voi.
Grazie dell'invito, sarei felice di partecipare, anche attivamente, se riesco
a fare entrare qualche piccolo fix nel mio tempo... Ci saro' con piacere
Venerdi innanzitutto.
Buona giornata e buon lavoro.
…--
Alessandro Di Stefano
https://it.linkedin.com/in/aleskandro
https://alessandrodistefano.eu
mail@alessandrodistefano.eu
tel: +393881452341
|
Buongiorno, ho anche io lo stesso problema con python3.8 e ubuntu 20.04. Nessuno ha una soluzione che non sia downgrade di pyhton alla 3.7? I'm trying Odoo 12.0 |
Propongo di chiudere il thread, python 3.8 non è ben supportato da Odoo v. 12.0, il consiglio è di fare downgrade (i test di OCA addirittura usano python 3.5). |
Hey, more than a year after the initial post I'd like to ask the status of this issue. I'm still running into the very same error with Python 3.8. Has it been fixed by now? |
No, but there is a project to left PyXB |
Yeah, I've noticed that PyXB is officially end-of-life. I'm working with a fork of PyXB (conqp/pyxb) now which fixes this issue. So, never mind! I guess after such a long time and considering the circumstances this issue can be closed. |
Italian modules for v14 use xmlschema instead of PyXB. |
Actually I came here because of the error message and the relation to PyXB. xmlschema is a good advice, will check it out. A downgrade to a previous Python version because of an EOL'd library is a technical debt that I'm not willing to take, as that would pin me to Python 3.7 till the end of days. We have a production ready Python 3.9 nowadays. Anything permanently incompatible is thus out of question. |
Why this issue is closed? The problem still persist. There is a fix waiting for merge (#970507a). Is this package still maintained? Downgrade to older version of Python is not such an alternative like @HWiese1980 said. |
Do you have a link? |
Versioni coinvolte: 12.0-20200813
Passi per riprodurre: Generata una fattura, dal dettaglio, click su Esporta e-fattura -> Esporta fattura elettronica -> Esporta
Comportamento osservato: Errore
Comportamento atteso: Esportazione XML e-fattura
Si allega errore
Errore:
Odoo Server Error
Traceback (most recent call last):
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 941, in call
return self.method(*args, **kw)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/api.py", line 746, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/addons/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py", line 885, in exportFatturaPA
attach = self.saveAttachment(fatturapa, number)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/addons/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py", line 108, in saveAttachment
attach_str = fatturapa.toxml(
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 560, in toxml
dom = self.toDOM(bds, element_name=element_name)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 532, in toDOM
self._toDOM_csc(bds, element)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2694, in _toDOM_csc
content.elementDeclaration.toDOM(dom_support, parent, content.value)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
value._toDOM_csc(dom_support, element)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2694, in _toDOM_csc
content.elementDeclaration.toDOM(dom_support, parent, content.value)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
value._toDOM_csc(dom_support, element)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2694, in _toDOM_csc
content.elementDeclaration.toDOM(dom_support, parent, content.value)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
value._toDOM_csc(dom_support, element)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 2694, in _toDOM_csc
content.elementDeclaration.toDOM(dom_support, parent, content.value)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/content.py", line 1101, in toDOM
value._toDOM_csc(dom_support, element)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 1137, in _toDOM_csc
dom_support.appendTextChild(self, parent)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/utils/domutils.py", line 584, in appendTextChild
return parent.appendChild(self.document().createTextNode(self.valueAsText(text)))
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/odoo/addons/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py", line 81, in valueAsText
return super(FatturapaBDS, self)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/utils/domutils.py", line 402, in valueAsText
return value.xsdLiteral()
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/basis.py", line 1010, in xsdLiteral
return self.XsdLiteral(self)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/datatypes.py", line 761, in XsdLiteral
value += datetime.timedelta(minutes=cls.__MinutesPerHalfDay)
File "/home/bruno/odoo-testing/odoo12/lib/python3.8/site-packages/pyxb/binding/datatypes.py", line 685, in new
raise TypeError('function takes %d arguments plus optional tzinfo (%d given)' % (len(cls._ValidFields), len(args)))
TypeError: function takes 3 arguments plus optional tzinfo (8 given)
Facendo debug, noto che in setDatiGeneraliDocumento la data della fattura viene passata correttamente (2020-08-15), ma in pyxb viene convertita in una datetime (2020-08-15 00:00:00) attraverso il metodo compatibleValue. A quel punto i parametri diventano 8 (anno, mese, giorno, ore, minuti e secondi) mentre il datatype se ne attende solo tre (anno, mese e giorno).
The text was updated successfully, but these errors were encountered: