[FIX]: Try to select destination address which has no partner on it

lp bug: https://launchpad.net/bugs/710516 fixed

bzr revid: ksa@tinyerp.co.in-20110211104624-5gqtxl14itgw1xvz
This commit is contained in:
ksa (Open ERP)
2011-02-11 16:16:24 +05:30
parent c7117d134c
commit f77e00af19
+7 -4
View File
@@ -170,7 +170,7 @@ class purchase_order(osv.osv):
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"),
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]",
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
help="Put an address if you want to deliver directly from the supplier to the customer." \
"In this case, it will remove the warehouse link and set the customer location."
@@ -257,9 +257,12 @@ class purchase_order(osv.osv):
def onchange_dest_address_id(self, cr, uid, ids, adr_id):
if not adr_id:
return {}
part_id = self.pool.get('res.partner.address').read(cr, uid, [adr_id], ['partner_id'])[0]['partner_id'][0]
loc_id = self.pool.get('res.partner').browse(cr, uid, part_id).property_stock_customer.id
return {'value':{'location_id': loc_id, 'warehouse_id': False}}
values = {'warehouse_id': False}
part_id = self.pool.get('res.partner.address').browse(cr, uid, adr_id).partner_id
if part_id:
loc_id = part_id.property_stock_customer.id
values.update({'location_id': loc_id})
return {'value':values}
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id):
if not warehouse_id: