It is currently Wed May 23, 2012 2:51 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Is it possible to auto-generate a 'fields.char' field ?
PostPosted: Fri Jul 29, 2011 3:17 am 
Offline

Joined: Wed Jun 15, 2011 7:22 pm
Posts: 104
Hello,

I would like to retrieve a field value and put it in a field of type 'fields.char (...)', for example the field' name 'of' product '.
I was able to do that with fields of types 'fields.related (...)' and' 'fields.function (...) and I would like to know if it is possible to do that with a 'fields .char (...) field ?

Thank you for your answers.


Top
 Profile  
 
 Post subject: Re: Is it possible to auto-generate a 'fields.char' field ?
PostPosted: Fri Jul 29, 2011 5:23 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
As an example that is precisely what the description field of sale.order.line does.

It uses an onchange method in order to achieve this. onchange_product_id. This method is a little bit complex to learn about onchange from, but there is plenty of examples in source code and documentation on how to do this.

However it only changes when the field(s) to which the onchange method is assigned change.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Is it possible to auto-generate a 'fields.char' field ?
PostPosted: Fri Jul 29, 2011 6:41 pm 
Offline

Joined: Wed Jun 15, 2011 7:22 pm
Posts: 104
Thank you for your answer.

I didn't find any 'onchange_product_id' method. I found 'product_id_change' method in 'sale.py' and I couldn't understand it.

I created a class 'Myclass' witch inherits 'product.product'.
I have a functional field 'Myfield' wich the value is calculated by the function 'Myfunction'.
What I would like to do is:
To put the value of 'Myfield' automatically in the field 'name' of 'Myclass' (field constructed by inheritance).

I tried to use on_change events with no success.
Could you help me please?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP