Hi Peter,

Am 29.11.2016 um 20:08 schrieb Peter Müller:
> I have the following code, but the client does nothing on the menu item.
> I can't figure out where it is broken.

You have to register the Person class in your extension module. This is
usually done in the __init__.py  of your module.

> Tryton 4.0
> 
> # -------------------------------------------------------------
> # person.py:
> from trytond.pool import PoolMeta
> from trytond.model import ModelView, ModelSQL, fields
> 
> __all__ = ['Person']
> 
> GENDER = [ ('M', 'Male'), ('F', 'Female'), ]
> 
> class Person(ModelSQL, ModelView):
>     'Person'
>     __metaclass__ = PoolMeta
>     __name__ = 'party.party'
>     gender   = fields.Selection(GENDER,'Gender')
> 
> # -------------------------------------------------------------
> # module.xml:
>         <record model="ir.ui.view" id="person_view_form">
>            <field name="model">party.party</field>
>            <field name="type">form</field>
>            <field name="name">person_form</field>
>         </record>
> 
>         <record model="ir.action.act_window.view" id="act_persons_view">
>            <field name="sequence" eval="10"/>
>            <field name="view" ref="person_view_form"/>
>            <field name="act_window" ref="act_persons_win"/>
>         </record>
> 
>         <record model="ir.action.act_window" id="act_persons_win">
>             <field name="name">Persons</field>
>             <field name="res_model">party.party</field>
>         </record>
> 
>         <menuitem name="Person" sequence="10" id="menu_person"
> action="act_persons_win"/>
> # -------------------------------------------------------------
> # view/person_form.xml:
> <?xml version="1.0"?>
> <form string="Person" col="2">
>     <label name="gender"/>
>     <field name="gender"/>
> </form>
>   
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "tryton-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tryton-dev/407e22a8-41ad-431a-8d49-bfb92e9269d2%40googlegroups.com
> <https://groups.google.com/d/msgid/tryton-dev/407e22a8-41ad-431a-8d49-bfb92e9269d2%40googlegroups.com?utm_medium=email&utm_source=footer>.


Best regards

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/74f3f5c5-0430-5459-2838-bc277800beea%40peschke-it.de.

Reply via email to