Community mailing list archives

community@mail.odoo.com

Re: PURCHASE ONCHANGE METHOD

by
Edwin Blommaerts
- 11/30/2015 07:04:02
Hi Peter,

I think it would be useful if you could post the error message you received and the field definition for both model and view.

Thanks,



2015-11-30 11:22 GMT+00:00 Peter Mudoko <petypi@gmail.com>:
Hi guys have created another field on purchase order form called miles and want to echo this field on my invoice , have added field miles on invoice form have defined onchange method on invoice  to update miles field automatically from my purchase.order as follows

def on_change_mileage(self,cr,uid,ids,miles,context=None):
   
            order_obj = self.pool.get('purchase.order')
   mileage = order_obj.browse(cr, uid, miles, context=context)
            res = { 'value': {'miles': mileage.miles}}
#Return the values to update it in the view.
   return res

But am getting an error, how can i effectively update my miles field on invoice from purchase.order mile field.


Production Team Leader

SoftlinkOptions Ltd,

Nairobi:gate 256, Rhapta Road,Mvuli road,Westlands, Nairobi.

P.O.Box - 45855 -00100, Nairobi.

Tel:+254 721449067

Email petypi@gmail.com

Mobile: +254 721449067

Website www.softlinkoptions.com

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe