Hi,
I'm trying to rename party's property field 'payment_term' into 
'customer_payment_term' in account_invoice module and realized this is 
currently not possible. 

The reason is that ir.property has a many2one on delete cascade relationship 
with ir.model.field. Fields are added to ir.model.field in Model.init() and no 
longer existing fields are also removed from ir.model.field in the same 
function. This means that we cannot UPDATE ir.property information before 
calling super's init because we do not have the entry in ir.model.field and we 
cannot do it later because records have already been removed from ir.property 
because of the delete cascade relationship to ir.model.field.

One option would be to add a hook to Model.init() between field creation and 
removal so we could override in account_invoice module to update the necessary 
information. The hook could be called "init_before_fields_removal()" for 
example, or maybe somebody can find a better name.

Another thing related to properties is that in 'ir.property' there's a field 
called 'name' which seems to store redundant information because the name of 
the property is already stored in ir.model.field. Is there really a need for 
such field or maybe we should remove it?

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