Hi there, do you know our module party_type[1]? It is implemented a litte bit different, but it seems that it does what you need.
[1] http://beta.intuxication.org/ukoma/party_type/log/ Regards Korbinian Am Mittwoch, den 30.03.2011, 07:05 -0700 schrieb Artur_J: > Sorry, i was thinking it is ovious from my description. > > I'm currently at home so this is the code i remember: > > ... > > class Person(ModelSQL, ModelView): > 'Person' > _name = 'scrm.person' > _description = __doc__ > _inherits = {'party.party': 'party'} > > party = fields.Many2One('party.party', 'Party', required=True, > ondelete='CASCADE') > > forename = fields.Char('Forename', required=True, select=1) > surname = fields.Char('Surname', required=True, select=1) > ... > > > Now party.party has a required 'name' field: > > ... > > class Party(ModelSQL, ModelView): > "Party" > _description = __doc__ > _name = "party.party" > > name = fields.Char('Name', required=True, select=1, states=STATES) > ... > > I would like to update name (in party.party) every time either > forename or surname (in scrm.person) is changed. > The idea behind this is when you create/modify an entity "Person" you > don't have to enter the name (party.name), only surname and forename, > and the name field of party.party is updated according to the values > of the surname and forename fields in scrm.person. > > > On 30 Mrz., 11:31, Cédric Krier <[email protected]> wrote: > > On 29/03/11 05:06 -0700, Artur_J wrote: > > > > > Hello, > > > > > I have a question about subclassing in Tryton 1.8. Maybe i explain > > > first what i would like to do: i have two fields: forename and surname > > > (and titles but i will omit it here) and a function which creates a > > > string "surname, forename". This fields are in a model which inherits > > > from (not extend!) Party (via _inherits mechanism). The problem is > > > that party has a required name field and i would like to auto-generate > > > it with my function from the surname and forename fields. > > > After long research i couldn't find a soulution - it seems that the > > > on_change/on_change_with Field attributes would be the way to go, but > > > i couldn't make them work across related models. Is there a solution > > > for this? > > > > I'm pretty sure there is but you should show the code if you want some help. > > > > -- > > Cédric Krier > > > > B2CK SPRL > > Rue de Rotterdam, 4 > > 4000 Liège > > Belgium > > Tel: +32 472 54 46 59 > > Email/Jabber: [email protected] > > Website:http://www.b2ck.com/ > > > > application_pgp-signature_part > > < 1 KBAnzeigenHerunterladen > -- Korbinian Preisler ____________________________________ virtual things Preisler & Spallek GbR Munich - Aix-la-Chapelle Windeckstr. 77 81375 Munich - Germany Tel: +49 (89) 710 481 55 Fax: +49 (89) 710 481 56 [email protected] http://www.virtual-things.biz -- [email protected] mailing list
