~equipovision/openerp-web/supermas-dev-web-7.0

« back to all changes in this revision

Viewing changes to addons/web/static/src/js/view_form.js

[FIX] web: on SearchPopup creation concat build context even if we have initial_ids

  On SearchPopupCreation, if we have initial_ids - 1st search_read() will be
  missing custom context defined on the field.

  1. defined view like this: <field name='my_many2one_field_id' context="{'test': 1}"/>
  2. in we expand the list of available item, name_search() has 'test' in context
  3. in we click on 'Search More', search_read() is missing 'test' in context
  4. if we change filter add/remove item, search_read() will have 'test' in context

  Step 3. is wrong, should also have 'test' in context

Show diffs side-by-side

added added

removed removed

Lines of Context:
4796
4796
        this.searchview.on('search_data', self, function(domains, contexts, groupbys) {
4797
4797
            if (self.initial_ids) {
4798
4798
                self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]),
4799
 
                    contexts, groupbys);
 
4799
                    contexts.concat(self.context), groupbys);
4800
4800
                self.initial_ids = undefined;
4801
4801
            } else {
4802
4802
                self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys);