Browse Source

Add comment to explain the hack for the POS

pull/88/head
Alexis de Lattre 8 years ago
parent
commit
1c3e7d6187
  1. 6
      base_phone/base_phone.py

6
base_phone/base_phone.py

@ -72,12 +72,16 @@ class PhoneCommon(models.AbstractModel):
'Wrong self._partner_field'
countrycode = None
if self._country_field and vals.get(self._country_field):
# When updating a partner in the frontend of the POS
# Odoo generate a write() with the ID of the country as unicode !!!
# example : vals = {u'country_id': u'9'}
# So we have to convert it to an integer before browsing
country = self.env['res.country'].browse(
int(vals[self._country_field]))
countrycode = country.code
elif self._partner_field and vals.get(self._partner_field):
partner = self.env['res.partner'].browse(
int(vals[self._partner_field]))
vals[self._partner_field])
countrycode = partner.country_id.code or False
return countrycode

Loading…
Cancel
Save