Browse Source

[FIX][mis_builder] Fix the creation of a new mis.report.instance.

pull/170/head
Adrien Peiffer (ACSONE) 9 years ago
parent
commit
2e0967fcee
  1. 4
      mis_builder/models/mis_builder.py
  2. 10
      mis_builder/static/src/js/mis_builder.js

4
mis_builder/models/mis_builder.py

@ -667,12 +667,12 @@ class MisReportInstance(models.Model):
@api.multi @api.multi
def display_settings(self): def display_settings(self):
self.ensure_one()
assert len(self._ids) <= 1
view_id = self.env.ref('mis_builder.mis_report_instance_view_form') view_id = self.env.ref('mis_builder.mis_report_instance_view_form')
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'mis.report.instance', 'res_model': 'mis.report.instance',
'res_id': self.id,
'res_id': self.id if self.id else False,
'view_mode': 'form', 'view_mode': 'form',
'view_type': 'form', 'view_type': 'form',
'views': [(view_id.id, 'form')], 'views': [(view_id.id, 'form')],

10
mis_builder/static/src/js/mis_builder.js

@ -13,15 +13,23 @@ openerp.mis_builder = function(instance) {
reload_widget: function() { reload_widget: function() {
var self = this var self = this
self.mis_report_instance_id = self.getParent().datarecord.id self.mis_report_instance_id = self.getParent().datarecord.id
if (self.mis_report_instance_id) {
self.generate_content(); self.generate_content();
} else {
self.display_settings();
}
}, },
start: function() { start: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
var self = this; var self = this;
self.mis_report_instance_id = self.getParent().datarecord.id self.mis_report_instance_id = self.getParent().datarecord.id
//self.getParent().dataset.context['no_destroy'] = true;
if (self.mis_report_instance_id) {
self.getParent().dataset.context['no_destroy'] = true;
self.generate_content(); self.generate_content();
} else {
self.display_settings();
}
}, },
get_context: function() { get_context: function() {

Loading…
Cancel
Save