Error when select other address of partner

Asked by Thach Nguyen

Hi all,

I create a new purchase order (PO) :
   In purchase order form, I selected a supplier for PO, the address of supplier is showed correctly. But When I am choosing other address of this supplier in address field then address field show address of other supplier instead of supplier 's address that I have choosen in the first time

I have investigated in source code and I realized that when i am choosing other address of supplier, the onchange_partner_id function is activated and this function get parameter is id of partner address but in onchange_partner_id function, this parameter is known as id of partner. So, this function will return address of other partner

<code>
def onchange_partner_id(self, cr, uid, ids, part):
        if not part:
            return {'value':{'partner_address_id': False, 'fiscal_position': False}}
        addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
        part = self.pool.get('res.partner').browse(cr, uid, part)
        pricelist = part.property_product_pricelist_purchase.id
        fiscal_position = part.property_account_position and part.property_account_position.id or False
        return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
</code>

So, anybody can explain to me about this problem?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Thach Nguyen
Solved:
Last query:
Last reply:
Revision history for this message
Thach Nguyen (nguyencothach1989) said :
#1

I fixed