Coder Social home page Coder Social logo

tryton-training's Introduction

Tryton Training

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.

tryton-training's People

Contributors

jcavallo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tryton-training's Issues

Docs link wrong

The link in the initial wiki page says "doc.tryton.org", but it should be "docs.tryton.org".

Author genre is not existing befor homework 2 but assumed

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 !

How to use this repository is missing in Latest version (5.0)

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

One2One field

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.

Old python syntax for 5.0

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

Step 6 - Code snippet does not work

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

Update tryton-server command

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:

https://github.com/coopengo/tryton-training/wiki/5.0-step1

https://github.com/coopengo/tryton-training/wiki/5.0-step10

typos on wiki 5.0/step10

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)

Environment Setup -- Postgres -- User autorisation Error

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'\""

Use sqlite as database

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.

Cannot Instantiate Books properly

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.