On 27/09/11 11:12 +0200, Albert Cervera i Areny wrote:
> A Dimarts, 27 de setembre de 2011 09:33:37, Cédric Krier va escriure:
> > But how do you manage default values?
> 
> Is there a need for default values? I mean, why should there be default 
> values 
> for a field that depends on the company but not for other fields?

Because you can change the default value and then it is changed for all
records that get this default value.
It is a pretty good behavior and it is useful for example on account
properties because it let the user change it for all parties in one change.

> That said, 
> default values could be set by letting company field to be NULL (see below). 
> It 
> may require an explicit configuration section, but mabe that is more 
> "Trytonic" 
> than existing behaviour?

But how the field should know that it must filter or not on this field.
By default there is no company in trytond.

> > And also I don't see how the behavior of the Property fields could be
> > changed as it is now for multi-company.
> 
> Forgot to add it in the model, of course, a Property would have no sense 
> without a Company:

It has usage without company. Company is just an extra option added by the
company module but others module could add others possibilities.

> class party.party.customer_payment_term(ModelSQL):
>      party = fields.Many2One('party.party)
>      payment_term = fields.Many2One('account.invoice.payment_term')
>      company = fields.Many2One('company.company')
> 
> One could also think of extending existing Properties to handle something 
> like 
> this:
> 
> field_name = fields.Property('company.department', fields.Many2One(....))
> 
> so one could make properties depend on other "things" apart from the company.

This makes things difficult to override as it is part of the field definition.
Than you must override every Property fields to add the new behavior.

-- 
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/

Attachment: pgpVwsr6BTCKA.pgp
Description: PGP signature

Reply via email to