INFO:ext synchro:Updated in OpenERP res.partner.address from External Ref with external_id 0 and OpenERP id 2 successfully

Bug #746351 reported by Guilleret Florian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
Confirmed
Undecided
Unassigned

Bug Description

When I import order kind of orders tell this :

INFO:ext synchro:Updated in OpenERP res.partner.address from External Ref with external_id 0 and OpenERP id 2 successfully

The issue is that in some order mapped address_shipping and all address to id 2 instead of create new one so many order had the same adress update by next order who had this issue.

I don't understand why this bug occure. Can someone had same issue ?

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

There is some issues on Magento with sales_order.info which returns no id for addresses, maybe your magento returns 0 for customer_address_id so the mapping in ir_model_data is created with an id 0 like
name : 'res_partner_address/0'
res_id: 2

If it is the case I think we should modify sale.py to something like :
    def get_mage_customer_address_id(self, address_data):
- if address_data.get('customer_address_id', False):
+ if address_data.get('customer_address_id', False) and address_data['customer_address_id'] != '0':

Revision history for this message
Guilleret Florian (guilleret-florian) wrote :

I agree with you Guewen, I analyze both system ( magento with Mage::log() ) and oerp with ntsv so magento send customer_address_id 0 ( I don't know why )

And oerp go here :

return {'customer_address_id': 'mag_order' + str(address_data['address_id']), 'is_magento_order_address': True}

So I change :

        if address_data.get('customer_address_id', False):
by
        if address_data.get('customer_address_id', False) and address_data['customer_address_id'] != '0':

I test this solution now ( and all works fine )

Revision history for this message
Kyle Waid (midwest) wrote :

Can this be pushed to the mainline if it is indeed a bug and there is a fix

Revision history for this message
Kyle Waid (midwest) wrote :

This fix doesnt completely fix the issue. What happens here is it is passing partner id. If partner id exists, it will update the address overwriting any existing sale order that used this id. I have had this problem in a large customer. It is a plague. The best way is to ensure a new address is created each time by commenting out the first 3 lines. There is also a situation where magento could pass false instead of 0 for customer id, and situation where customer changes the shipping address at the very end of the order. This change if occurring will overwrite and existing customer address that shares the id. In this situation an id could be passed like 19224 but they are completely different addresses. The system only cares that the id matches, and in which case it will overwrite all existing orders.

Changed in magentoerpconnect:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.