Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Avoid overwrite name field over a company customer #202

Open
wants to merge 1 commit into
base: 8.0
Choose a base branch
from

Conversation

kikopeiro
Copy link

When you are importing an update of an company customer the "company" field is not saved properly in field "name".

@guewen
Copy link
Member

guewen commented Mar 18, 2016

Hi,

Thanks for your PR!

Could you give an example? With the current behaviour and your expected result.

@kikopeiro
Copy link
Author

We have already created a company with magento_connector on Odoo.

This customer is configurated has follows in Magento...
Customer information: there is not much to say
Customer addess: is_billing_default --> True, company_field --> filled

The customer in ERP has been created has follows:
Customer information --> name --> the information in Magento "company" field in the address object

If latter we update the customer in Magento,the information when we import to Odoo is not properly setted

Customer information: name --> the information in Magento "name" field in the address object

Thanks

@guewen
Copy link
Member

guewen commented Mar 18, 2016

Ok, I think I get it.
It should be corrected in the mapper, did you identify why the mapper set it the first time and not the second one?

@kikopeiro
Copy link
Author

Mapper seems is working fine, _get_address_infos function in PartnerAddressBook. Here the code set the company field in customer name on Odoo

                company_mapper = self.unit_for(CompanyImportMapper,
                                               model='magento.res.partner')
                map_record = company_mapper.map_record(magento_record)
                parent = partner_binding.openerp_id.parent_id
                values = map_record.values(parent_partner=parent)
                **partner_binding.write(values)**

but after this "write" the partner information is being overwritten while executes function "run" for the address import.

    **addresses = self._get_address_infos(magento_partner_id,
                                        partner_binding_id)**
    for address_id, infos in addresses:
        importer = self.unit_for(MagentoImporter)
        **importer.run(address_id, address_infos=infos)**

@guewen
Copy link
Member

guewen commented Mar 18, 2016

Still, you should probably not need to modify the importer, the address mapper could return the correct name at first place.

@StefanRijnhart StefanRijnhart added this to the 8.0 milestone Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants