ݺߣ

ݺߣShare a Scribd company logo
Tryton Unfrequently
Given Answers
● Let’s talk about some of the least frequently used Tryton features.
●
● If you don’t know they exist, you cannot take advantage of them!
0/Tryton Unfrequently Given Answers
● Use it to add a currency or percentage symbol in tree views:
●
● <tree>
● <field name="percentage">
● <suffix name="percentage" string="%"/>
● </field>
● </tree>
●
● http://doc.tryton.org/4.6/trytond/doc/topics/views/index.html?
highlight=suffix
1/prefix & suffix
● Allows you to apply a view inheritance conditionally. Example: Show a
field to some users only.
●
● Although it is named “domain” it actually is a PySON expression.
●
● <record model=”ir.ui.view” id=”xxxx”>
● <field name=”model”>model.name</field>
● <field name=”type”>form</field>
● <field name=”domain” eval=”Eval(‘context’, {}).get(‘user’) == 1”
pyson=”1”/>
● <field name=”name”>model_name_form</field>
● </record>
2/ir.ui.view domain
● Allows you to update the value of several fields just like on_change.
●
● Data is not stored before the button is pushed.
●
● @ModelView.button_change(‘field1’, ‘field2’)
● def update_fields(self):
● self.field3 = self.field1 + self.field2
3/button_change
● Provided by ModelStorage (which ModelSQL inherits)
●
● Use this method to check a tree hierarchy has no loops.
4/check_recursion()
● Model method to return information to be shown in Global Search
5/search_global()
● Use werkzeug routes
●
● Grant access to some routes to apps
●
● http://doc.tryton.org/4.6/trytond/doc/topics/user_application.html
6/user_application
● They’re readonly! Allow you to link two views.
●
● <field name="domain" eval="[('parent', '=',
Get(Eval('timesheet.act_work_tree2', {}), 'id', None))]" pyson="1"/>
●
● <record model="ir.action.keyword" id="act_work_keyword">
● <field name="keyword">graph_open</field>
● <field name="model">timesheet.work,-1</field>
● <field name="action" ref="act_open_work_graph"/>
● </record>
●
●
7/Board View
● Open URLs with the browser
●
● Should be possible to open tryton:// URLs.
8/URL Actions
● Icons are loaded once when the user logs in with the corresponding
client.
●
● <record model="ir.ui.icon" id="contract_icon">
● <field name="name">tryton-contract</field>
● <field name="path">icons/tryton-contract.svg</field>
● </record>
●
● <menuitem id="menu_contract" name="Contracts" icon="tryton-
contract"/>
9/Icons & Images
http://www.NaN-tic.com
Albert Cervera i Areny
albert@nan-tic.com
@albertnan
linkedin.com/in/albertca
Tryton Unfrequently Given Answers

More Related Content

Tryton Unfrequently Given Answers

  • 2. ● Let’s talk about some of the least frequently used Tryton features. ● ● If you don’t know they exist, you cannot take advantage of them! 0/Tryton Unfrequently Given Answers
  • 3. ● Use it to add a currency or percentage symbol in tree views: ● ● <tree> ● <field name="percentage"> ● <suffix name="percentage" string="%"/> ● </field> ● </tree> ● ● http://doc.tryton.org/4.6/trytond/doc/topics/views/index.html? highlight=suffix 1/prefix & suffix
  • 4. ● Allows you to apply a view inheritance conditionally. Example: Show a field to some users only. ● ● Although it is named “domain” it actually is a PySON expression. ● ● <record model=”ir.ui.view” id=”xxxx”> ● <field name=”model”>model.name</field> ● <field name=”type”>form</field> ● <field name=”domain” eval=”Eval(‘context’, {}).get(‘user’) == 1” pyson=”1”/> ● <field name=”name”>model_name_form</field> ● </record> 2/ir.ui.view domain
  • 5. ● Allows you to update the value of several fields just like on_change. ● ● Data is not stored before the button is pushed. ● ● @ModelView.button_change(‘field1’, ‘field2’) ● def update_fields(self): ● self.field3 = self.field1 + self.field2 3/button_change
  • 6. ● Provided by ModelStorage (which ModelSQL inherits) ● ● Use this method to check a tree hierarchy has no loops. 4/check_recursion()
  • 7. ● Model method to return information to be shown in Global Search 5/search_global()
  • 8. ● Use werkzeug routes ● ● Grant access to some routes to apps ● ● http://doc.tryton.org/4.6/trytond/doc/topics/user_application.html 6/user_application
  • 9. ● They’re readonly! Allow you to link two views. ● ● <field name="domain" eval="[('parent', '=', Get(Eval('timesheet.act_work_tree2', {}), 'id', None))]" pyson="1"/> ● ● <record model="ir.action.keyword" id="act_work_keyword"> ● <field name="keyword">graph_open</field> ● <field name="model">timesheet.work,-1</field> ● <field name="action" ref="act_open_work_graph"/> ● </record> ● ● 7/Board View
  • 10. ● Open URLs with the browser ● ● Should be possible to open tryton:// URLs. 8/URL Actions
  • 11. ● Icons are loaded once when the user logs in with the corresponding client. ● ● <record model="ir.ui.icon" id="contract_icon"> ● <field name="name">tryton-contract</field> ● <field name="path">icons/tryton-contract.svg</field> ● </record> ● ● <menuitem id="menu_contract" name="Contracts" icon="tryton- contract"/> 9/Icons & Images
  • 12. http://www.NaN-tic.com Albert Cervera i Areny albert@nan-tic.com @albertnan linkedin.com/in/albertca