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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions magentoerpconnect/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,16 @@ def _get_magento_data(self):
return self.address_infos.magento_record
else:
return super(AddressImporter, self)._get_magento_data()

def _clean_fields_company(self, data):
""" Avoid overwrite name field when we import a company. """
if data.get('is_default_billing', False) and data.get('company', False):
data['name'] = data['company']
return data

def _update(self, binding, data):
data = self._clean_fields_company(data)
return super(AddressImporter, self)._update(binding, data)

def _define_partner_relationship(self, data):
""" Link address with partner or parent company. """
Expand Down