Skip to content

Commit

Permalink
Merge 95df211 into 631e6d9
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpeiffer committed Mar 11, 2016
2 parents 631e6d9 + 95df211 commit 17a200b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
17 changes: 16 additions & 1 deletion mis_builder/models/mis_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def preview(self):
'view_mode': 'form',
'view_type': 'form',
'view_id': view_id.id,
'target': 'new',
'target': 'current',
}

@api.multi
Expand Down Expand Up @@ -665,6 +665,21 @@ def export_xls(self):
'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
Expand Down
4 changes: 4 additions & 0 deletions mis_builder/static/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
/* underline links on hover to give a visual cue */
text-decoration: underline;
}

.openerp .oe_mis_builder_buttons {
padding-bottom: 10px;
}
27 changes: 22 additions & 5 deletions mis_builder/static/src/js/mis_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ openerp.mis_builder = function(instance) {
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.getParent().dataset.context['no_destroy'] = true;
self.generate_content();
},

Expand Down Expand Up @@ -44,9 +51,18 @@ openerp.mis_builder = function(instance) {
[self.mis_report_instance_id],
{'context': context}
).then(function(result){
self.do_action(result).done(function(result){
a = 2;
});
self.do_action(result);
});
},
display_settings: function() {
var self = this
context = new instance.web.CompoundContext(self.build_context(), self.get_context()|| {})
new instance.web.Model("mis.report.instance").call(
"display_settings",
[self.mis_report_instance_id],
{'context': context}
).then(function(result){
self.do_action(result);
});
},
generate_content: function() {
Expand All @@ -66,6 +82,7 @@ openerp.mis_builder = function(instance) {
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",
Expand Down
3 changes: 2 additions & 1 deletion mis_builder/static/src/xml/mis_widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 3 additions & 2 deletions mis_builder/views/mis_builder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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">
Expand Down

0 comments on commit 17a200b

Please sign in to comment.