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

All times are UTC + 2 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [SOLVED] _defaults{ question
PostPosted: Fri Jul 29, 2011 2:15 pm 
Offline

Joined: Wed Nov 25, 2009 2:36 pm
Posts: 73
Location: Germany
Hallo,

here is what i want to do:

in sale order there is a field which contains a discount percent value.
if i add a new line to the order the default value of the discount field of sale.order.line should be the value of the discount percent field of the sale order.
I know i have to inherit the sale.order.line class and add _defaults {discount: but i don't know how get the value of the field in sale.order, becaus sale.order.line.order_id isn't filled out yet.

any ideas?

Thank you.

aw

_________________
OpenERP 6.0.3 on Ubuntu 10.04 LTS Server
Clients: WinXP SP3 & Win7 GTK


Last edited by aw on Tue Aug 02, 2011 7:15 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: _defaults{ question
PostPosted: Fri Jul 29, 2011 10:25 pm 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
Defaults could work but it would be really messy and user unfriendly IMO. Having to save parent, then sale order line to populate default.

You should use an onchange method instead which can access unsaved values. A lot like a sale order line uses the unsaved parent pricelist when calculating price.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: _defaults{ question
PostPosted: Mon Aug 01, 2011 8:50 am 
Offline

Joined: Wed Nov 25, 2009 2:36 pm
Posts: 73
Location: Germany
You are absolutely right.

I shouldn't do such things on friday afternoons...

I'll try it that way.

Thank you so far.

_________________
OpenERP 6.0.3 on Ubuntu 10.04 LTS Server
Clients: WinXP SP3 & Win7 GTK


Top
 Profile  
 
 Post subject: Re: _defaults{ question
PostPosted: Mon Aug 01, 2011 2:20 pm 
Offline

Joined: Wed Nov 25, 2009 2:36 pm
Posts: 73
Location: Germany
works fine.

Thank you.

_________________
OpenERP 6.0.3 on Ubuntu 10.04 LTS Server
Clients: WinXP SP3 & Win7 GTK


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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