Initial question on module development

30 views
Skip to first unread message

Peter Müller

unread,
Nov 29, 2016, 7:10:04 PM11/29/16
to tryton-dev
I have the following code, but the client does nothing on the menu item.
I can't figure out where it is broken.
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>
  

Ralf Peschke

unread,
Nov 30, 2016, 2:34:43 AM11/30/16
to tryto...@googlegroups.com
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.
> --
> 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

Peter Müller

unread,
Nov 30, 2016, 4:05:03 AM11/30/16
to tryton-dev
Hi Ralf,

thank you for your input.

nevermind, the problem was a mix-up of modules updating with wrong data.
After creating a new db it is working.

Regards, Peter

Reply all
Reply to author
Forward
0 new messages