On 2010-10-21 17:23, sdistefano wrote:
Hi,
I'm looking into adding some functionality to tryton for my business.
I would need to customize existing modules quite heavily, and add
code to them to connect to other systems. I'm wondering what is the
tryton way to do this.
I was in that situation myself. Rather than starting off with
customizing tryton though, I began by building middle-ware to sit
in-between the 'other systems' and tryton. Since a lot of my
provisioning tools were already xmlrpc enabled, building something that
could talk xmlrpc to tryton on the one hand, and xmlrpc to my other
interfaces on the other was fairly straightforward. Using Proteus this
has even become completely trivial.
Of course there will always be things you need modified in tryton proper:
Can I, for example, subclass an entire module? Otherwise, what is the
recommended way of expanding the functionality of those modules that
already exist?
Extending models and views is well understood:
say you want to customize the Party model. You then create a new class
with the same name in your local module:
class Party(ModelSQL, ModelView):
"""Party"""
_name='party.party'
# add your own additional fields
contracts = fields.One2Many('contract.contract',
'party', 'Contracts',
readonly=True)
Party()
Extending views is equally straightforward:
http://doc.tryton.org/1.6/trytond/doc/topics/views/extension.html#topics-extension
If you want to override behaviour of existing methods, you should look
at the _inherits attribute:
http://doc.tryton.org/1.6/trytond/doc/ref/models/models.html#trytond.model.Model._inherits
In that case you define your own Model type which has full access to the
inherited model. In this case however you need to hook-up the new model
to the menu and create all views (which may inherit views from other
models).
--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
--
[email protected] mailing list