openlabs / magento_integration

Magento OpenERP Integration
https://openerp-magento-connector.readthedocs.org/en/develop/
80 stars 77 forks source link

incorrect usage of for else causes guaranteed duplication of addresses #241

Open aliomattux opened 9 years ago

aliomattux commented 9 years ago

I see this module has not bee updated in over a year but for what its worth,

in partner.py there is a for each loop that checks customer addresses for a match. see link https://github.com/openlabs/magento_integration/blob/develop/partner.py#L230

Python for else does not work the way described in the method description. No matter the result the else statement will always be called, meaning that in every case a new address will be created. Why call break? Why not just return the address that matches

sharoonthomas commented 9 years ago

@aliomattux yep, you are absolutely right. Do you want to send a pull request for the ?