[FIX] Avoid overwrite name field over a company customer
When you are importing an update of an company customer the "company" field is not saved properly in field "name".
Hi,
Thanks for your PR!
Could you give an example? With the current behaviour and your expected result.
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
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?
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)**
Still, you should probably not need to modify the importer, the address mapper could return the correct name at first place.