The command line seems incomplete, there is no name for the database option.
Also what is the content of trytond.conf
, I do not think the script works with a different language than English.
This is the content of trytond.conf:
[database]
uri = postgresql://tryton_prueba:mypass@localhost:5432/
path = /var/lib/tryton
language = nl
[web]
listen = 0.0.0.0:8000
root = /home/prueba/sao
I put him in: language = en ?
In the statement if it has the name of the database, I forgot to put it:
$ python3 tryton_demo.py -c /etc/tryton/trytond.conf -d mydb
It must be en
(or remove the line). The script only works with English as database language.
Perfect.
When I changed the language, everything worked and I imported it without any major problem.
Thank you CED.
I’m going to tinker with my server and do all the tests I need.
Most of this thread is related to loading demo data, and it was very helpful for me. So, I will share my solution, in case it helps someone in the future.
(NOT Attached the script and .env file) I use to create and initialize databases. It also loads demo data if named “demo”. This is used on a docker compose solution.
Here are the shell commands (extracted from the NOT attached script) that I used to load demo data (you might need to adjust to run standalone):
DATABASE="demo" # Replace with your database name
AVATARS_URL="https://www.tryton.org/~demo/avatars/"
TOOL_URL="https://foss.heptapod.net/tryton/tools/-/raw/branch/default/tryton_demo.py?inline=false"
# Modules to install
MODULES="account account_invoice account_payment account_statement company country currency"
MODULES="${MODULES} party party_avatar product production production_routing production_work"
MODULES="${MODULES} project purchase sale stock timesheet"
# Install wget to download avatars
apt update && apt install wget > /dev/null 2>&1
# Download avatars
mkdir -p ~/avatars && cd ~/avatars"
wget --recursive --no-parent --level=1 --no-directories --reject='index.html*' ${AVATARS_URL} > /dev/null 2>&1
# Begin: Fix bug
FIND=" = set.union(\*to_success.values(), \*to_fail.values())"
REPLACE="${FIND} if to_success or to_fail else set()"
FILE="/usr/local/lib/python3.11/dist-packages/trytond/modules/account_payment/account.py"
sed -i 's/${FIND}/${REPLACE}/g' '${FILE}'
# grep ' if to_success or to_fail else set()' '${FILE}'
# End: Fix bug
# Download and run tool
cd ~ && curl --location --output tryton_demo.py ${TOOL_URL}
python3 ~/tryton_demo.py --database ${DATABASE} --module ${MODULES}
There is a bug fix “hack” embedded in the above code, which needs to be properly reported.
Thanks to everyone who shared in this thread, specially CED, who gave me enough pointers to come up with a usable script; including the quick bug fix, which I adapted from some related bug he fixed in the past.