if context is None:
context = {}
data = super(survey_page, self).default_get(cr, uid, fields, context)
- self.pool.get('survey.question').data_get(cr,uid,data,context)
if context.has_key('survey_id'):
data['survey_id'] = context.get('survey_id', False)
return data
'context': context
}
- def data_get(self, cr, uid, data, context):
- if data and context:
- if context.get('line_order', False):
- lines = context.get('line_order')
- seq = data.get('sequence', 0)
- for line in lines:
- seq = seq + 1
- data.update({'sequence': seq})
- return data
-
def default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
data = super(survey_question, self).default_get(cr, uid, fields, context)
- self.data_get(cr,uid,data,context)
if context.has_key('page_id'):
data['page_id']= context.get('page_id', False)
return data
if context is None:
context = {}
data = super(survey_answer, self).default_get(cr, uid, fields, context)
- self.pool.get('survey.question').data_get(cr,uid,data,context)
return data
survey_answer()
</group>
<notebook colspan="4">
<page string="Survey">
- <field name="page_ids" colspan="4" nolabel="1" mode="form,tree" context="{'line_order': page_ids}">
+ <field name="page_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Survey Page">
<field name="title" select="1"/>
<field name="sequence" groups="base.group_extended"/>
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
- <field name="question_ids" height="200" width="200" colspan="4" nolabel="1" context="{'line_order': question_ids}">
+ <field name="question_ids" height="200" width="200" colspan="4">
<form string="Survey Question" >
<group col="6" colspan="6" height="600" width="200">
<field name="question" colspan="4" select="1"/>
<group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
<separator string="Answer" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','=','table')]}">
- <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids, 'in_visible_answer_type': in_visible_answer_type}"/>
+ <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'in_visible_answer_type': in_visible_answer_type}"/>
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
<field name="column_heading_ids" colspan="4" nolabel="1" context="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
<field name="sequence"/>
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
- <field name="question_ids" colspan="4" nolabel="1" context="{'line_order': question_ids}">
+ <field name="question_ids" colspan="4" nolabel="1">
<form string="Survey Question">
<field name="question" colspan="4" select="1"/>
<field name="sequence"/>
<group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
<separator string="Answer" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','=','table')]}">
- <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids, 'in_visible_answer_type': in_visible_answer_type}"/>
+ <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'in_visible_answer_type': in_visible_answer_type}"/>
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
<field name="column_heading_ids" colspan="4" nolabel="1" context="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
<group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
<separator string="Answer" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','=','table')]}">
- <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids, 'in_visible_answer_type': in_visible_answer_type}"/>
+ <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'in_visible_answer_type': in_visible_answer_type}"/>
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
<field name="column_heading_ids" colspan="4" nolabel="1" context="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
<group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
<separator string="Answer" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','=','table')]}">
- <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids, 'in_visible_answer_type': in_visible_answer_type}"/>
+ <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'in_visible_answer_type': in_visible_answer_type}"/>
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
<field name="column_heading_ids" colspan="4" nolabel="1" context="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
});
this.$element.find('.oe-list-add')
- .click(this.do_add_record)
+ .click(this.proxy('do_add_record'))
.attr('disabled', grouped && this.options.editable);
this.$element.find('.oe-list-delete')
.attr('disabled', true)
- .click(this.do_delete_selected);
+ .click(this.proxy('do_delete_selected'));
this.$element.find('thead').delegate('th.oe-sortable[data-id]', 'click', function (e) {
e.stopPropagation();
this.no_leaf = !!context['group_by_no_leaf'];
this.reload_view(!!group_by, context).then(
- $.proxy(this, 'reload_content'));
+ this.proxy('reload_content'));
},
/**
* Handles the signal to delete lines from the records list
$row.remove();
self.refresh_zebra(index);
},
- 'reset': $.proxy(this, 'on_records_reset'),
+ 'reset': function () { return self.on_records_reset(); },
'change': function (event, record) {
var $row = self.$current.find('[data-id=' + record.get('id') + ']');
$row.replaceWith(self.render_record(record));
});
},
render: function () {
+ var self = this;
if (this.$current) {
this.$current.remove();
}
this.$current = this.$_element.clone(true);
this.$current.empty().append(
QWeb.render('ListView.rows', _.extend({
- render_cell: $.proxy(this, 'render_cell')}, this)));
+ render_cell: function () { return self.render_cell(); }
+ }, this)));
this.pad_table_to(5);
},
pad_table_to: function (count) {
record: record,
row_parity: (index % 2 === 0) ? 'even' : 'odd',
view: this.view,
- render_cell: $.proxy(this, 'render_cell')
+ render_cell: function () { return this.render_cell(); }
});
},
/**
this.page = 0;
- this.records.bind('reset', $.proxy(this, 'on_records_reset'));
+ var self = this;
+ this.records.bind('reset', function () {
+ return self.on_records_reset(); });
},
make_fragment: function () {
return document.createDocumentFragment();