This module was written by Coopengo to help with training new employees.
Please go on to the wiki for instructions on how to use it.
This module was written by Coopengo to help with training new employees.
Please go on to the wiki for instructions on how to use it.
https://github.com/coopengo/tryton-training/wiki/5.0-step1 reads:
Open the init.py file and write down the following:
โฆ
import library
For clarity and expressiveness, this should become a relative import. Current officail tryton modules use relatvice imports, too, see e.g. https://hg.tryton.org/modules/commission/file/tip/__init__.py#l5
Anyhow, I wonder how this does work at all, as in Python 3 this is an absolute import and will import a completly different module.
There is quite a few typos on page 10,
especially regarding the classes definitions:
library.user:
checkouts = fields.One2Many('library.user.checkout', 'user', 'Checkouts')
library.user.checkout:
user = fields.Many2One('library.user', 'User', required=True,
ondelete='CASCADE', select=True)
exemplary = fields.Many2One('library.book.exemplary', 'Exemplary',
required=True, ondelete='CASCADE', select=True)
should be remplaced by this:
class User(ModelSQL, ModelView):
'Library User'
__name__ = 'library.user'
checkouts = fields.One2Many('library.user.checkout', 'user', 'Checkouts')
class Checkout(ModelSQL, ModelView):
'Checkout'
__name__ = 'library.user.checkout'
user = fields.Many2One('library.user', 'User', required=True,
ondelete='CASCADE', select=True)
exemplary = fields.Many2One('library.book.exemplary', 'Exemplary',
required=True, ondelete='CASCADE', select=True)
Hello
I was a little bit confuses, when I looked at the "5.0 step2 correction".
There is written:
You should have one more field on the library.author model. It should be wisely named editor, and be defined right before or after the existing genre field (since it is a data field).
But in https://github.com/coopengo/tryton-training/wiki/5.0-step2 I found nothing written about changing or adding something to class Author / 'library.author'.
We can also see this here: https://github.com/coopengo/tryton-training/blob/5.0/step2_completed/modules/library/library.py
May it should be 'library.book' instead of 'library.author'.
Even I was thinking we need to add 'books' field on 'library.author' :-)
Thanks for you work, I am very excited !
Please can you help as I want to create one2one field for my project in Tryton and I cannot find any one2one example which can help me out.
Thank you.
Kind regards.
During the setup step (https://github.com/coopengo/tryton-training/wiki/5.0-setup), an error occur when typing the following command
(develop) coopengo@coopengo-ThinkPad-T490:~$ createdb training --username=postgres
createdb: could not connect to database template1: FATAL: Peer authentication failed for user "postgres"
It seems that editing the file /etc/postgresql/x.x/main/pg_hba.conf and remplacing this line
local all postgres peer
by this line
local all postgres trust
and restarting postgres using
sudo service postgresql restart
seems to fix the issue.
alternatively this command might be usefull:
sudo su postgres -c "psql -c \"CREATE ROLE tryton WITH LOGIN SUPERUSER PASSWORD 'tryton'\""
It's needed to update the package installation command name to python3-openssl on setup 5.0
For the next release, please change the documentation to use a sqlite database. A sqlite db requires much less resources and managing it is much easier than a postgresql db. And for this training, a sqlite db suffices, I assume.
I was unable to install on Ubuntu 18.04
I first need to install "libpq-dev"
apt install libpq-dev
pip install psycopg2
Thanks for tutorial
URL to Tryton documentation refer to https://doc.tryton.org rather than https://docs.tryton.org
In the Exemplary section of the library.xml, the model reference should be library.book.exemplary
rather than library.exemplary
A patch to fix these issues is attached
fix-typo.patch.txt
Cannot Instantiate Books using the book form
This is because exmplary needs to have a unique identifer
This is because the One2Many exemplaries field has a wrong default value
Possible solution:
go from
@classmethod
def default_exemplaries(cls):
return [{}]
to
@classmethod
def default_exemplaries(cls):
return []
https://github.com/coopengo/tryton-training/blob/5.0/step10/modules/library/library.py
this issue is simple to understand but might affect quite a lot of branches
this is especially troubling toward the end of the tutorial since the book form has been stripped from the exemplary page:
https://github.com/coopengo/tryton-training/blob/5.0/step10/modules/library/view/book_form.xml
On ubuntu distribution the command
trytond-admin -c Path/to/trytond.conf -d training -u MODULE_NAME
seems to have no effect ?
However, adding a -v argument seems to fix the problem :
(develop) coopengo@coopengo-ThinkPad-T490:~/Bureau/projects/training$ trytond-admin -c ~/Bureau/projects/training/trytond.conf -d training -u library
(develop) coopengo@coopengo-ThinkPad-T490:~/Bureau/projects/training$ trytond-admin -v -c ~/Bureau/projects/training/trytond.conf -d training -u library
3855 139952998561600 [2019-10-28 14:57:35,735] INFO trytond.backend.postgresql.database connect to "training"
3855 139952998561600 [2019-10-28 14:57:35,833] WARNING py.warnings /home/coopengo/.local/lib/python3.6/site-packages/trytond/wsgi.py:13: DeprecationWarning: The import 'werkzeug.wsgi.SharedDataMiddleware' is deprecated and will be removed in Werkzeug 1.0. Use 'from werkzeug.wsgi.middleware.shared_data import SharedDataMiddleware' instead.
from werkzeug.wsgi import SharedDataMiddleware
3855 139952998561600 [2019-10-28 14:57:35,851] INFO trytond.modules ir:registering classes
3855 139952998561600 [2019-10-28 14:57:35,851] INFO trytond.modules res:registering classes
3855 139952998561600 [2019-10-28 14:57:35,851] INFO trytond.modules library:registering classes
3855 139952998561600 [2019-10-28 14:57:35,852] INFO trytond.modules tests:registering classes
3855 139952998561600 [2019-10-28 14:57:35,852] INFO trytond.pool init pool for "training"
3855 139952998561600 [2019-10-28 14:57:35,863] INFO trytond.modules ir
3855 139952998561600 [2019-10-28 14:57:35,863] INFO trytond.pool setup pool for "training"
3855 139952998561600 [2019-10-28 14:57:35,921] INFO trytond.modules res
3855 139952998561600 [2019-10-28 14:57:35,921] INFO trytond.pool setup pool for "training"
3855 139952998561600 [2019-10-28 14:57:35,941] INFO trytond.modules library
3855 139952998561600 [2019-10-28 14:57:35,941] INFO trytond.pool setup pool for "training"
3855 139952998561600 [2019-10-28 14:57:35,949] INFO trytond.modules library:register library.genre
3855 139952998561600 [2019-10-28 14:57:35,966] INFO trytond.modules library:register library.editor
3855 139952998561600 [2019-10-28 14:57:35,980] INFO trytond.modules library:register library.editor-library.genre
3855 139952998561600 [2019-10-28 14:57:36,001] INFO trytond.modules library:register library.author
3855 139952998561600 [2019-10-28 14:57:36,015] INFO trytond.modules library:register library.book
3855 139952998561600 [2019-10-28 14:57:36,044] INFO trytond.modules library:register library.book.exemplary
3855 139952998561600 [2019-10-28 14:57:36,061] INFO trytond.modules library:register library.book.create_exemplaries.parameters
3855 139952998561600 [2019-10-28 14:57:36,063] INFO trytond.modules library:register library.book.fuse.select_main
3855 139952998561600 [2019-10-28 14:57:36,065] INFO trytond.modules library:register library.book.fuse.preview
3855 139952998561600 [2019-10-28 14:57:36,067] INFO trytond.modules library:register library.book.create_exemplaries
3855 139952998561600 [2019-10-28 14:57:36,068] INFO trytond.modules library:register library.book.fuse
3855 139952998561600 [2019-10-28 14:57:36,071] INFO trytond.modules library:loading library.xml
3855 139952998561600 [2019-10-28 14:57:36,115] INFO trytond.modules library:loading wizard.xml
3855 139952998561600 [2019-10-28 14:57:36,133] INFO trytond.pool setup mixin for "training"
3855 139952998561600 [2019-10-28 14:57:36,134] INFO trytond.modules all modules loaded
(develop) coopengo@coopengo-ThinkPad-T490:~/Bureau/projects/training$
Alternatively the --dev argument might also be useful.
Look for theese pages and add a -v argument to the commands:
Some of your commits have file with old python syntax:
import library
new python syntax must be :
from . import library
. being the current directory, might be a sub directory if you like.
Minor problem but affects a lot (or all) of your branches,
here is a few of them:
https://github.com/coopengo/tryton-training/blob/5.0/step10_completed/modules/library/__init__.py
https://github.com/coopengo/tryton-training/blob/5.0/step7_homework/modules/library/__init__.py
https://github.com/coopengo/tryton-training/blob/5.0/step4_completed/modules/library/__init__.py
This is a marvelous tutorial! I stumbled over many missing links (all links to documentation are broken) and some typos... but nevertheless: This tutorial is great!
In Step6 though I found a snippet that does not work at all - and I don't know how to fix (tryton 5.4):
https://github.com/coopengo/tryton-training/wiki/5.0-step6
In the section Validate:
@classmethod
def setup(cls):
super().setup()
cls._error_messages.update({
'invalid_isbn': 'ISBN should only be digits',
})@classmethod
def validate(cls, books):
for book in books:
if not book.isbn:
continue
try:
if int(book.isbn) < 0:
raise ValueError
except ValueError:
cls.raise_user_error('invalid_isbn')
Thanks for your tutorial - I am enjoying it!
Kind regards,
Marco
So, without this, this is hard to understand:
git checkout 5.0/step2
fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
so do I have to clone first?:
git clone https://github.com/coopengo/tryton-training.git
And then using this foder for virtual env?
virtualenv -p $(which python3) tryton-training
Or should that be different directories?
Thanks
The link in the initial wiki page says "doc.tryton.org", but it should be "docs.tryton.org".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.