1 2 3 4 5 6 7 8 9 10 11 12 13 | try:
Import the right environment
except ImportError:
raise Exception("Tryton is not for you!")
try:
Introduction to framework
Instant hacking
if time:
Bonus features
except (NoTime, NotInterested, UrMadAtMe):
raise Exception("Lets stop here")
finally:
Questions
|
Security:
authentication
access rules:
- by model
- by record
Protocols (optionally over SSL):
Best open source RDBMS: PostgreSQL
Also Supports:
Next Release Goal:
Fundamentals
__init__.py
__tryton__.py
opportunity.py (Models and Logic)
opportunity.xml (Views, Security etc Presentation)
fr_FR.csv (Translations)
setup.py (Python setup tools file)
docs/ (In module documentation)
tests/ (Unit Tests)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {
'name' : '<Name of Module>',
'version' : '<Version>',
'author' : '<Author>',
'email': '<Valid email of Author>',
'website': '<Author Website>',
'description': '<Very descriptive description of module>',
'depends' : [
<str Name of Dependent Module>,
],
'xml' : [
],
'translation': [
],
}
|
1 2 3 4 5 6 7 8 9 | from trytond.model import ModelSQL
class Opportunity(ModelSQL):
'Opportunity'
_description = __doc__
_name = 'training.opportunity'
Opportunity()
|
1 2 3 4 5 6 7 8 9 10 11 12 13 | class Opportunity(ModelSQL):
'Opportunity'
_description = __doc__
_name = 'training.opportunity'
_rec_name = 'description'
description = fields.Char('Description', required=True)
start_date = fields.Date('Start Date', required=True)
end_date = fields.Date('End Date')
party = fields.Many2One('party.party', 'Party', required=True)
comment = fields.Text('Comment')
Opportunity()
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <record model="ir.ui.view" id="opportunity_view_tree">
<field name="model">training.opportunity</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<![CDATA[
<tree string="Opportunities">
<field name="party" select="1"/>
<field name="description" select="1"/>
<field name="start_date" select="1"/>
<field name="end_date" select="2"/>
</tree>
]]>
</field>
</record>
|
contd....
Action Keyword
- tree_open: after double click in a tree view
- tree_action: when pressing action button in a tree view
- form_print: click on print button
1 2 3 4 5 6 7 8 9 10 | def default_start_date(self, cursor, user, context=None):
"""
Applies default value to a field
syntax: def default_<field name>(...
:param cursor: Database Cursor
:param user: ID of current user
:param context: Context from Tryton
"""
date_obj = self.pool.get('ir.date')
return date_obj.today(cursor, user, context=context)
|
![]() |
|
Source : Flickr By : Philip Klinger
- Dynamic property change to fields
- Editable? Required? Visible? based on on screen vars or backend vars
- Use of PYSON PYthon Statement and Object Notation
>>> from trytond.pyson import Equal >>> Equal(1,2) <trytond.pyson.Equal object at 0x7f7a4e178bd0> >>> Equal(1,2).pyson() {'s2': 2, 's1': 1, '__class__': 'Equal'}
1 2 3 | Eval('active_id', -1)
#Python Equivalent
'active_id' in locals() and active_id or -1
|
1 2 3 4 | If(In('company', Eval('context', {})), '=', '!=')
#Python Equivalent
'context' in locals() and isinstance(context, dict) \
and 'company' in context and '=' or '!='
|
1 2 3 | states={
'readonly': Not(Equal(Eval('state'), 'opportunity')),
}
|
1 2 3 4 5 6 7 | class Party(ModelSQL, ModelView):
_name = 'party.party'
opportunities = fields.One2Many('training.opportunity', 'party',
'Opportunities')
Party()
|
1 2 3 4 | <xpath expr="/path/to/target[@id='id of target']"
position="after">
......
</xpath>
|
Wizards are magical people who defend themselves with magical things.
Real world example:
- Do you have time to continue this presentation ?
- You are lucky to be here ;-)
- Calendar & Caldav
- Open Office Reports (Relatorio)
- Email infrastructure
- Web framework
- IRC:#tryton on irc.freenode.net
- Google groups: tryton-dev and tryton (Mailing lists)
Any questions?
- BTW, I am @sharoonthomas
- and I work for @openlabsindia