Looking at Cédric comments on [1] it came to mind an idea on how I think 
properties could be better managed. 

AFAIK properties currently only allow Many2One values and they use Reference 
fields to point to the records which are somewhat slower to process and most 
important do not use referential integrity features of the underlying DBMS. I 
think properties could be changed to use a One2Many() field underneath and 
automatically create a new model to store their information.

For example, the following code:

    customer_payment_term = fields.Property(fields.Many2One(
              'account.invoice.payment_term', string='Customer Payment Term'))

Could automatically create a new model equivalent to:

class party.party.customer_payment_term(ModelSQL):
    party = fields.Many2One('party.party),
    payment_term = fields.Many2One('account.invoice.payment_term'),

or could be expected the developer to create it manually.

This would had the advantage of using referential integrity and support all 
field types out of the box. It may also mean improved performance as well as 
creating a more intuitive database structure for those who need to extract 
information from the database.

If the proposal sounds reasonable I will add a wishlist on the bugtracker.

[1] http://codereview.tryton.org/122001/

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Tel: +34 93 553 18 03

http://twitter.com/albertnan 
http://www.nan-tic.com/blog

-- 
[email protected] mailing list

Reply via email to