summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJorge Pinna Puissant <jpp@odoo.com>2019-08-12 08:39:07 +0000
committerJorge Pinna Puissant <jpp@odoo.com>2019-08-12 08:39:07 +0000
commitcb3c2e64c367c5b46bb8d4e253473c162e4dbaca (patch)
tree81d2fca0177c01bae88ac936cac49c0267ca53b2 /addons
parenta53ca4f949a7b5f2c44678eeedb6db912bc21ada (diff)
[FIX] partner_autocomplete, web: autocomplete error when suggested company has a country
- Change the company's country to Finland; - Go to Contacts and click on Create; - Tick the Company box above the Name field; - Start typing into the Name field; - Click on a company with a VAT number under its name. Before this commit, a Traceback appears. This occurs because the response of the request with the suggested company has the fields 'company_name' and 'company_code' and these fields are not in res_partner. Now, the suggested company is parsed to correctly field the country field. opw-2049636 closes odoo/odoo#35631 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/partner_autocomplete/models/res_partner.py2
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js6
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/partner_autocomplete/models/res_partner.py b/addons/partner_autocomplete/models/res_partner.py
index 16199d84e8c..3ea4014f657 100644
--- a/addons/partner_autocomplete/models/res_partner.py
+++ b/addons/partner_autocomplete/models/res_partner.py
@@ -110,7 +110,7 @@ class ResPartner(models.Model):
if suggestions:
results = []
for suggestion in suggestions:
- results.append(suggestion)
+ results.append(self._format_data_company(suggestion))
return results
else:
return []
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index ce4f01ab467..70fae723866 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1456,9 +1456,9 @@ var BasicModel = AbstractModel.extend({
// apply changes to local data
for (var fieldName in changes) {
field = record.fields[fieldName];
- if (field.type === 'one2many' || field.type === 'many2many') {
+ if (field && (field.type === 'one2many' || field.type === 'many2many')) {
defs.push(this._applyX2ManyChange(record, fieldName, changes[fieldName], options.viewType, options.allowWarning));
- } else if (field.type === 'many2one' || field.type === 'reference') {
+ } else if (field && (field.type === 'many2one' || field.type === 'reference')) {
defs.push(this._applyX2OneChange(record, fieldName, changes[fieldName]));
} else {
record._changes[fieldName] = changes[fieldName];
@@ -1473,7 +1473,7 @@ var BasicModel = AbstractModel.extend({
var onChangeFields = []; // the fields that have changed and that have an on_change
for (var fieldName in changes) {
field = record.fields[fieldName];
- if (field.onChange) {
+ if (field && field.onChange) {
var isX2Many = field.type === 'one2many' || field.type === 'many2many';
if (!isX2Many || (self._isX2ManyValid(record._changes[fieldName] || record.data[fieldName]))) {
onChangeFields.push(fieldName);