[IMP][mis_builder] Improve usability : Display directly report instance instead of report instance settings.
parent
2fd5a39296
commit
d61a88d6f0
|
@ -600,7 +600,7 @@ class MisReportInstance(models.Model):
|
|||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'view_id': view_id.id,
|
||||
'target': 'new',
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
@ -627,6 +627,21 @@ class MisReportInstance(models.Model):
|
|||
'context': self.env.context,
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def display_settings(self):
|
||||
self.ensure_one()
|
||||
view_id = self.env.ref('mis_builder.mis_report_instance_view_form')
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'mis.report.instance',
|
||||
'res_id': self.id,
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'views': [(view_id.id, 'form')],
|
||||
'view_id': view_id.id,
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def compute(self):
|
||||
assert len(self) == 1
|
||||
|
|
|
@ -18,13 +18,19 @@ var MisReport = form_common.FormWidget.extend({
|
|||
this._super.apply(this, arguments);
|
||||
this.mis_report_data = null;
|
||||
this.mis_report_instance_id = false;
|
||||
this.field_manager.on("view_content_has_changed", this, this.reload_widget);
|
||||
},
|
||||
|
||||
reload_widget: function() {
|
||||
var self = this
|
||||
self.mis_report_instance_id = self.getParent().datarecord.id
|
||||
self.generate_content();
|
||||
},
|
||||
|
||||
start: function() {
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
self.mis_report_instance_id = self.getParent().dataset.context.active_id
|
||||
self.getParent().dataset.context['no_destroy'] = true;
|
||||
self.mis_report_instance_id = self.getParent().datarecord.id
|
||||
self.generate_content();
|
||||
},
|
||||
|
||||
|
@ -56,8 +62,18 @@ var MisReport = form_common.FormWidget.extend({
|
|||
[self.mis_report_instance_id],
|
||||
{'context': context}
|
||||
).then(function(result){
|
||||
self.do_action(result).done(function(result){
|
||||
});
|
||||
self.do_action(result);
|
||||
});
|
||||
},
|
||||
display_settings: function() {
|
||||
var self = this
|
||||
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {})
|
||||
new Model("mis.report.instance").call(
|
||||
"display_settings",
|
||||
[self.mis_report_instance_id],
|
||||
{'context': context}
|
||||
).then(function(result){
|
||||
self.do_action(result);
|
||||
});
|
||||
},
|
||||
generate_content: function() {
|
||||
|
@ -77,6 +93,7 @@ var MisReport = form_common.FormWidget.extend({
|
|||
var self = this;
|
||||
self.$(".oe_mis_builder_print").click(_.bind(this.print, this));
|
||||
self.$(".oe_mis_builder_export").click(_.bind(this.export_pdf, this));
|
||||
self.$(".oe_mis_builder_settings").click(_.bind(this.display_settings, this));
|
||||
},
|
||||
events: {
|
||||
"click a.mis_builder_drilldown": "drilldown",
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<div class="oe_mis_builder_content">
|
||||
<div class="oe_mis_builder_buttons oe_right">
|
||||
<button class="oe_mis_builder_print"><img src="/web/static/src/img/icons/gtk-print.png"/> Print</button>
|
||||
<button class="oe_mis_builder_export"><img src="/web/static/src/img/icons/gtk-execute.png"/>Export</button>
|
||||
<button class="oe_mis_builder_export"><img src="/web/static/src/img/icons/gtk-go-down.png"/>Export</button>
|
||||
<button class="oe_mis_builder_settings"><img src="/web/static/src/img/icons/gtk-execute.png"/> Settings</button>
|
||||
</div>
|
||||
<table t-if="widget.mis_report_data" class="oe_list_content mis_builder">
|
||||
<thead>
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<record model="ir.ui.view" id="mis_report_instance_result_view_form">
|
||||
<field name="name">mis.report.instance.result.view.form</field>
|
||||
<field name="model">mis.report.instance</field>
|
||||
<field name="priority" eval="17"/>
|
||||
<field name="priority" eval="15 "/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="MIS Report Result" version="7.0">
|
||||
<widget type="mis_report"></widget>
|
||||
|
@ -139,6 +139,7 @@
|
|||
<field name="target_move"/>
|
||||
<field name="pivot_date"/>
|
||||
<field name="company_id"/>
|
||||
<button name="display_settings" type="object" icon="gtk-execute" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -161,7 +162,7 @@
|
|||
<div class="oe_right oe_button_box" name="buttons">
|
||||
<button type="object" name="preview" string="Preview" icon="gtk-print-preview" />
|
||||
<button type="object" name="print_pdf" string="Print" icon="gtk-print" />
|
||||
<button type="object" name="export_xls" string="Export" icon="gtk-execute" />
|
||||
<button type="object" name="export_xls" string="Export" icon="gtk-go-down" />
|
||||
<button type="action" name="%(mis_report_instance_add_to_dashboard_action)d" string="Add to dashboard" icon="gtk-add" />
|
||||
</div>
|
||||
<group col="4">
|
||||
|
|
Loading…
Reference in New Issue