[IMP] hr_timesheet_sheet: in web part, made the analytic account clickable
authorniv-openerp <nicolas.vanhoren@openerp.com>
Fri, 26 Oct 2012 09:55:11 +0000 (11:55 +0200)
committerniv-openerp <nicolas.vanhoren@openerp.com>
Fri, 26 Oct 2012 09:55:11 +0000 (11:55 +0200)
bzr revid: nicolas.vanhoren@openerp.com-20121026095511-d811qw4t6fognkep

addons/hr_timesheet_sheet/static/src/js/timesheet.js
addons/hr_timesheet_sheet/static/src/xml/timesheet.xml

index 7de235e..e64c4d6 100644 (file)
@@ -4,6 +4,9 @@ openerp.hr_timesheet_sheet = function(instance) {
     var _t = instance.web._t;
 
     instance.hr_timesheet_sheet.WeeklyTimesheet = instance.web.form.FormWidget.extend(instance.web.form.ReinitializeWidgetMixin, {
+        events: {
+            "click .oe_timesheet_weekly_account a": "go_to",
+        },
         init: function() {
             this._super.apply(this, arguments);
             this.set({
@@ -26,6 +29,16 @@ openerp.hr_timesheet_sheet = function(instance) {
             this.render_drop = new instance.web.DropMisordered();
             this.description_line = _t("/");
         },
+        go_to: function(event) {
+            var id = JSON.parse($(event.target).data("id"));
+            this.do_action({
+                type: 'ir.actions.act_window',
+                res_model: "account.analytic.account",
+                res_id: id,
+                views: [[false, 'form']],
+                target: 'current'
+            });
+        },
         query_sheets: function() {
             var self = this;
             if (self.updating)
index 3bfca4c..f75342c 100644 (file)
@@ -15,7 +15,7 @@
                     <th class="oe_timesheet_weekly_date_head">Total</th>
                 </tr>
                 <tr t-foreach="widget.accounts" t-as="account">
-                    <td class="oe_timesheet_weekly_account"><t t-esc="widget.account_names[account.account]"/></td>
+                    <td class="oe_timesheet_weekly_account"><a href="javascript:void(0)" t-att-data-id="JSON.stringify(account.account)"><t t-esc="widget.account_names[account.account]"/></a></td>
                     <t t-set="day_count" t-value="0"/>
                     <t t-foreach="account.days" t-as="day">
                         <td t-att-class="(Date.compare(day.day, Date.today()) === 0 ? 'oe_timesheet_weekly_today' : '')">