From 1c3e7d61872482dc5ee8c6c7a95f08d93cf0fd5b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 19 May 2016 14:44:44 +0200 Subject: [PATCH] Add comment to explain the hack for the POS --- base_phone/base_phone.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base_phone/base_phone.py b/base_phone/base_phone.py index b704255..d633ad9 100644 --- a/base_phone/base_phone.py +++ b/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