From 4d6f9c02dc403f2423400541a016cdd75c1e68b8 Mon Sep 17 00:00:00 2001 From: Invitu Date: Sat, 29 Oct 2016 08:53:25 -1000 Subject: [PATCH] [FIX] Fix point_of_sale partner error --- base_phone/fields.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/base_phone/fields.py b/base_phone/fields.py index 859d50f..24ec7a0 100644 --- a/base_phone/fields.py +++ b/base_phone/fields.py @@ -117,6 +117,12 @@ def write(self, vals): fields_to_convert = get_phone_fields(self, vals) if fields_to_convert: for record in self: + # 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 + if vals[u'country_id']: + vals[u'country_id'] = int(vals[u'country_id']) loc_vals = convert_all_phone_fields( record, vals, fields_to_convert) original_write(record, loc_vals) @@ -130,6 +136,12 @@ def write(self, vals): def create(self, vals): fields_to_convert = get_phone_fields(self, vals) if fields_to_convert: + # When creating a partner in the frontend of the POS + # Odoo generate a create() 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 + if vals[u'country_id']: + vals[u'country_id'] = int(vals[u'country_id']) vals = convert_all_phone_fields(self, vals, fields_to_convert) return original_create(self, vals)