Hi all, Using V6 on Windows Can anyone help please me with this, I am trying to stop auto fill function onchange of partner id in sales order. We have lots of customers with many shipping addresses and the users of OpenERP always seem to put the wrong addresses in the shipping address location because the system fills it with a default one. I want the shipping address to be blank so that a user will have to select the correct shipping address everytime
class sale_order(osv.osv):
_inherit = "sale.order"
def onchange_partner_id(self, cr, uid, ids, part, context=None):
if not part:
return {'value': { 'payment_term': False, 'fiscal_position': False, 'partner_invoice_id': False, 'partner_order_id': False,}} #'partner_shipping_id': False,
part = self.pool.get('res.partner').browse(cr, uid, part, context=context)
addr = self.pool.get('res.partner').address_get(cr, uid, [part.id], ['invoice', 'contact'])
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
payment_term = part.property_payment_term and part.property_payment_term.id or False
fiscal_position = part.property_account_position and part.property_account_position.id or False
dedicated_salesman = part.user_id and part.user_id.id or uid
val = {
'partner_invoice_id': addr['invoice'],
'partner_order_id': addr['contact'],
# 'partner_shipping_id': addr['delivery'],
'payment_term': payment_term,
'fiscal_position': fiscal_position,
'user_id': dedicated_salesman,
}
if pricelist:
val['pricelist_id'] = pricelist
return {'value': val}
sale_order()
Does it work ?