Harry (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-addons11-mail-hip into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons11-mail-hip/+merge/126162
Resolve Issues on My Feeds and My Posts: clicking on an arrow in the left of a
feed and on "remove notification" / "quote and reply": error message in Firefox
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons11-mail-hip/+merge/126162
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-addons11-mail-hip.
=== modified file 'hr_timesheet_sheet/__init__.py'
--- hr_timesheet_sheet/__init__.py 2012-04-02 05:44:18 +0000
+++ hr_timesheet_sheet/__init__.py 2012-09-25 06:16:26 +0000
@@ -20,6 +20,7 @@
##############################################################################
import hr_timesheet_sheet
+import hr_timesheet_week
import wizard
import report
import res_config
=== modified file 'hr_timesheet_sheet/__openerp__.py'
--- hr_timesheet_sheet/__openerp__.py 2012-09-14 14:09:50 +0000
+++ hr_timesheet_sheet/__openerp__.py 2012-09-25 06:16:26 +0000
@@ -66,5 +66,9 @@
'auto_install': False,
'certificate': '0073297700829',
'application': True,
+ #web
+ "js": ['static/src/js/timesheet.js'],
+ #"css": ['static/src/css/timesheet.css'],
+ "qweb": ['static/src/xml/timesheet.xml'],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
--- hr_timesheet_sheet/hr_timesheet_sheet.py 2012-09-10 04:30:39 +0000
+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2012-09-25 06:16:26 +0000
@@ -69,38 +69,6 @@
context['sheet_id'] = id
return super(one2many_mod2, self).set(cr, obj, id, field, values, user=user, context=context)
-
-class one2many_mod(fields.one2many):
- def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if context is None:
- context = {}
-
- if values is None:
- values = {}
-
-
- res5 = obj.read(cr, user, ids, ['date_current'], context=context)
- res6 = {}
- for r in res5:
- res6[r['id']] = r['date_current']
-
- ids2 = []
- for id in ids:
- dom = []
- if id in res6:
- dom = [('date', '=', res6[id]), ('sheet_id', '=', id)]
- ids2.extend(obj.pool.get(self._obj).search(cr, user,
- dom, limit=self._limit))
- res = {}
- for i in ids:
- res[i] = []
- for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2,
- [self._fields_id], context=context, load='_classic_read'):
- if r[self._fields_id]:
- res[r[self._fields_id][0]].append(r['id'])
-
- return res
-
class hr_timesheet_sheet(osv.osv):
_name = "hr_timesheet_sheet.sheet"
_table = 'hr_timesheet_sheet_sheet'
@@ -323,12 +291,11 @@
'name': fields.char('Note', size=64, select=1,
states={'confirm':[('readonly', True)], 'done':[('readonly', True)]}),
'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
- 'user_id': fields.related('employee_id', 'user_id', type="many2one", relation="res.users", store=True, string="User", required=False, readonly=True),#fields.many2one('res.users', 'User', required=True, select=1, states={'confirm':[('readonly', True)], 'done':[('readonly', True)]}),
+ 'user_id': fields.related('employee_id', 'user_id', type="many2one", relation="res.users", store=True, string="User", required=False, readonly=True),
'date_from': fields.date('Date from', required=True, select=1, readonly=True, states={'new':[('readonly', False)]}),
'date_to': fields.date('Date to', required=True, select=1, readonly=True, states={'new':[('readonly', False)]}),
'date_current': fields.date('Current date', required=True, select=1),
- 'timesheet_ids' : one2many_mod('hr.analytic.timesheet', 'sheet_id',
- 'Timesheet lines', domain=[('date', '=', time.strftime('%Y-%m-%d'))],
+ 'timesheet_ids' : fields.one2many('hr.analytic.timesheet', 'sheet_id', 'Timesheet lines',
readonly=True, states={
'draft': [('readonly', False)],
'new': [('readonly', False)]}
@@ -494,6 +461,7 @@
return ts_line_ids
_columns = {
+ 'date_current': fields.datetime('Current work time'),
'sheet_id': fields.function(_sheet, string='Sheet',
type='many2one', relation='hr_timesheet_sheet.sheet',
store={
@@ -507,6 +475,21 @@
'date': _get_default_date,
}
+ def action_work_start(self,cr, uid, ids, context=None):
+ ids_to_stop = self.search(cr, uid, [('date_current','!=',False)], context=context)
+ self.action_work_stop(cr, uid, ids_to_stop, context=context)
+ for work in self.browse(cr, uid, ids, context=context):
+ work.write({'date_current':time.strftime('%Y-%m-%d %H:%M:%S')})
+ return True
+
+ def action_work_stop(self, cr, uid, ids, context=None):
+ for work in self.browse(cr, uid, ids, context=context):
+ date_current = datetime.strptime(work.date_current, '%Y-%m-%d %H:%M:%S')
+ unit_amount = (datetime.now() - date_current).seconds / 360
+ unit_amount += work.unit_amount
+ work.write({'unit_amount':unit_amount, 'date_current':False})
+ return True
+
def _check_sheet_state(self, cr, uid, ids, context=None):
if context is None:
context = {}
=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet_view.xml'
--- hr_timesheet_sheet/hr_timesheet_sheet_view.xml 2012-09-20 09:07:06 +0000
+++ hr_timesheet_sheet/hr_timesheet_sheet_view.xml 2012-09-25 06:16:26 +0000
@@ -40,6 +40,16 @@
</field>
</record>
+ <record id="hr_timesheet_week_tree" model="ir.ui.view">
+ <field name="name">hr.timesheet.week.tree</field>
+ <field name="model">hr.timesheet.week</field>
+ <field name="arch" type="xml">
+ <tree string="Timesheet by Week" editable="bottom">
+ <field name="account_id" domain="[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]" context="{'default_use_timesheets': 1}"/>
+ </tree>
+ </field>
+ </record>
+
<record id="hr_timesheet_sheet_form" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.form</field>
<field name="model">hr_timesheet_sheet.sheet</field>
@@ -71,7 +81,44 @@
</group>
</group>
<notebook>
- <page string="Daily">
+ <page string="Week">
+ <field context="{'sheet_id':active_id, 'tree_view_ref':'hr_timesheet_tree_view'}" name="timesheet_week_ids" nolabel="1"/>
+ </page>
+ <page string="Day">
+ <field colspan="4" context="{'date':date_current,'user_id':user_id}" name="timesheet_ids" nolabel="1">
+ <tree editable="top" string="Timesheet Lines">
+ <field name="date"/>
+ <field domain="[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
+ <field name="name"/>
+ <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time" sum="Total"/>
+ <field name="to_invoice" widget="selection"/>
+ <field invisible="1" name="journal_id"/>
+ <field invisible="1" name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
+ <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
+ <field invisible="1" name="amount"/>
+ <field invisible="1" name="general_account_id"/>
+ <field invisible="1" name="user_id" required="1"/>
+ <field invisible="1" name="date_current"/>
+ <button name="action_work_start" string="Start" type="object" reload="all" attrs="{'readonly': [('date_current', '!=', False)]}"/>
+ <button name="action_work_stop" string="Stop" type="object" attrs="{'readonly': [('date_current', '=', False)]}"/>
+
+ </tree>
+ <form string="Timesheet Lines" version="7.0">
+ <field name="date"/>
+ <field domain="[('type','=','normal'), ('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
+ <field name="name"/>
+ <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
+ <field name="to_invoice"/>
+ <field name="journal_id"/>
+ <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
+ <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
+ <field name="amount"/>
+ <field name="general_account_id"/>
+ <field name="user_id" required="1"/>
+ </form>
+ </field>
+ </page>
+ <page string="Attendance">
<group>
<div>
<button name="button_dummy" class="oe_inline" string="Go to" type="object" icon="terp-gtk-jump-to-ltr"/> :
@@ -101,34 +148,6 @@
<group col="4">
<field name="state_attendance"/>
</group>
- <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
- <tree editable="top" string="Timesheet Lines">
- <field invisible="1" name="date"/>
- <field domain="[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
- <field name="name"/>
- <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
- <field name="to_invoice" widget="selection"/>
- <field invisible="1" name="journal_id"/>
- <field invisible="1" name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
- <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
- <field invisible="1" name="amount"/>
- <field invisible="1" name="general_account_id"/>
- <field invisible="1" name="user_id" required="1"/>
- </tree>
- <form string="Timesheet Lines" version="7.0">
- <field name="date"/>
- <field domain="[('type','=','normal'), ('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
- <field name="name"/>
- <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
- <field name="to_invoice"/>
- <field name="journal_id"/>
- <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
- <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
- <field name="amount"/>
- <field name="general_account_id"/>
- <field name="user_id" required="1"/>
- </form>
- </field>
</page>
<page string="Summary">
<field colspan="4" name="period_ids" nolabel="1">
=== added file 'hr_timesheet_sheet/hr_timesheet_week.py'
--- hr_timesheet_sheet/hr_timesheet_week.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_sheet/hr_timesheet_week.py 2012-09-25 06:16:26 +0000
@@ -0,0 +1,225 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+from lxml import etree
+from datetime import datetime, timedelta
+from dateutil.relativedelta import relativedelta
+
+from osv import fields, osv
+from tools.translate import _
+import netsvc
+
+
+class hr_timesheet_week(osv.osv):
+ _name = "hr.timesheet.week"
+ _auto = False
+ _columns = {
+ 'sheet_id': fields.many2one('hr_timesheet_sheet.sheet', 'Sheet', required=True),
+ 'account_id': fields.many2one('account.analytic.account', 'Account',required=True),
+ }
+
+ def _day_fields(self, sheet):
+ date_from = datetime.strptime(sheet.date_from, '%Y-%m-%d')
+ date_to = datetime.strptime(sheet.date_to, '%Y-%m-%d')
+ columns = {}
+ for day in range((date_to-date_from).days + 1):
+ work_date = date_from + timedelta(days=day)
+ day_field = work_date.strftime('%Y%m%d')
+ columns[day_field] = fields.integer(work_date.strftime('%a'))
+ return columns
+
+ def _day_fields_view(self, node, day_columns):
+ dates = []
+ for day_field in day_columns:
+ dates.append(datetime.strptime(day_field, '%Y%m%d'))
+ dates.sort()
+ for day_field in dates:
+ etree.SubElement(node, 'field', {'sum': 'Total', 'name': datetime.strftime(day_field, '%Y%m%d'), 'default': '0'})
+ return True
+
+ def fields_get(self, cr, uid, allfields=None, context=None, write_access=True):
+ if context is None:
+ context = {}
+ result = super(hr_timesheet_week, self).fields_get(cr, uid, allfields=allfields, \
+ context=context, write_access=write_access)
+ sheet_id = context.get('sheet_id', False)
+ if not sheet_id:
+ return result
+ sheet_pool = self.pool.get('hr_timesheet_sheet.sheet')
+ sheet = sheet_pool.browse(cr, uid, sheet_id, context=context)
+ day_columns = self._day_fields(sheet)
+ for day_field in day_columns:
+ result[day_field] = fields.field_to_dict(self, cr, uid, day_columns[day_field], context=context)
+ if not write_access:
+ result[day_field]['readonly'] = True
+ result[day_field]['states'] = {}
+ return result
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ if context is None:
+ context = {}
+ result = super(hr_timesheet_week, self).fields_view_get(cr, uid, view_id, \
+ view_type, context, toolbar, submenu)
+ if context.get('tree_view_ref','') == 'hr_timesheet_tree_view' and view_type == 'tree':
+ day_fields = self.fields_get(cr, uid, context=context)
+ if 'account_id' in day_fields:
+ del day_fields['account_id']
+ if 'sheet_id' in day_fields:
+ del day_fields['sheet_id']
+ result['fields'].update(day_fields)
+ node = etree.fromstring(result['arch'])
+ self._day_fields_view(node, day_fields)
+ result['arch'] = etree.tostring(node)
+ return result
+
+ def _read_flat(self, cr, uid, ids, fields_to_read, context=None, load='_classic_read'):
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ result = []
+ if context is None:
+ context = {}
+ for work_id in ids:
+ account_id, sheet_id = tuple(work_id.split('-'))
+ context['sheet_id'] = int(sheet_id)
+ if fields_to_read == None:
+ fields_to_read = self.fields_get(cr, uid, context=context)
+ timesheet_ids = timesheet_pool.search(cr, uid, [('account_id','=',int(account_id)),('sheet_id','=',int(sheet_id))])
+ timesheets = timesheet_pool.read(cr, uid, timesheet_ids, ['account_id', 'sheet_id', 'date', 'unit_amount'], context=context, load=load)
+ if len(timesheets):
+ record = {'id': work_id}
+ if 'account_id' in fields_to_read:
+ record['account_id'] = timesheets[0]['account_id']
+ if 'sheet_id' in fields_to_read:
+ record['sheet_id'] = timesheets[0]['sheet_id']
+ day_values = {}
+ for timesheet in timesheets:
+ work_date = timesheet['date']
+ if work_date not in day_values:
+ day_values[work_date] = 0
+ day_values[work_date] += timesheet['unit_amount']
+
+ for day_key, day_value in day_values.items():
+ day = datetime.strptime(day_key, '%Y-%m-%d')
+ day_field = day.strftime('%Y%m%d')
+ if day_field in fields_to_read:
+ record[day_field] = day_value
+
+ result.append(record)
+ return result
+
+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ timesheet_ids = timesheet_pool.search(cr, uid, args, context=context)
+ records = []
+ for timesheet in timesheet_pool.browse(cr, uid, timesheet_ids, context=context):
+ virtual_id = '%s-%s' % (timesheet.account_id.id, timesheet.sheet_id.id)
+ if timesheet.account_id and virtual_id not in records:
+ records.append(virtual_id)
+ return records
+
+ def write(self, cr, uid, ids, vals, context=None):
+ res = False
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ for work_id in ids:
+ account_id, sheet_id = tuple(work_id.split('-'))
+ account_id = vals.get('account_id', int(account_id))
+ sheet_id = vals.get('sheet_id', int(sheet_id))
+ for day_field, value in vals.items():
+ if day_field in ['account_id', 'sheet_id']:
+ continue
+ day = datetime.strptime(day_field, '%Y%m%d')
+ timesheet_ids = timesheet_pool.search(cr, uid, [
+ ('account_id','=',account_id),
+ ('sheet_id','=',sheet_id),
+ ('date','>=',day.strftime('%Y-%m-%d 00:00:00')),
+ ('date','<=',day.strftime('%Y-%m-%d 23:59:59'))
+ ])
+ total_qty = 0
+ for timesheet in timesheet_pool.browse(cr, uid, timesheet_ids, context=context):
+ total_qty += timesheet.unit_amount
+ diff = value - total_qty
+ if diff > 0:
+ self._create_timesheet(cr, uid, sheet_id, account_id, {day_field: diff}, context=context)
+ elif diff < 0:
+ for timesheet in timesheet_pool.browse(cr, uid, timesheet_ids, context=context):
+ qty = timesheet.unit_amount + diff
+ if qty <= 0:
+ diff += timesheet.unit_amount
+ timesheet_pool.unlink(cr, uid, [timesheet.id], context=context)
+ else:
+ timesheet_pool.write(cr, uid, [timesheet.id], {'unit_amount': qty}, context=context)
+ break
+
+ return True
+
+ def _create_timesheet(self, cr, uid, sheet_id, account_id, day_vals, defaults=None, context=None):
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ if defaults is None:
+ fields_list = timesheet_pool.fields_get(cr, uid, context=context)
+ defaults = timesheet_pool.default_get(cr, uid, fields_list.keys(), context=context)
+ timesheet_ids = []
+ for day_field, value in day_vals.items():
+ if not value:
+ continue
+ day = datetime.strptime(day_field, '%Y%m%d')
+ timesheet_vals = defaults
+ timesheet_vals.update({
+ 'sheet_id': sheet_id,
+ 'name': _('Work on %s') % (day.strftime('%Y-%m-%d')),
+ 'account_id': account_id,
+ 'date': day.strftime('%Y-%m-%d %H:%M:%S'),
+ 'unit_amount': value
+ })
+ timesheet_ids.append(timesheet_pool.create(cr, uid, timesheet_vals, context=context))
+ return timesheet_ids
+
+
+ def create(self, cr, uid, vals, context=None):
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ account_id = vals['account_id']
+ del vals['account_id']
+ sheet_id = vals['sheet_id']
+ del vals['sheet_id']
+ timesheet_ids = self._create_timesheet(cr, uid, sheet_id, account_id, vals, context=context)
+ if timesheet_ids and len(timesheet_ids):
+ timesheet = timesheet_pool.browse(cr, uid, timesheet_ids[0], context=context)
+ sheet_id = timesheet.sheet_id.id
+ return '%s-%s' %(account_id, sheet_id)
+
+ def unlink(self, cr, uid, ids, context=None):
+ res = False
+ timesheet_pool = self.pool.get('hr.analytic.timesheet')
+ for work_id in ids:
+ account_id, sheet_id = tuple(work_id.split('-'))
+ timesheet_ids = timesheet_pool.search(cr, uid, [('account_id','=',int(account_id)),('sheet_id','=',int(sheet_id))])
+ res = timesheet_pool.unlink(cr, uid, timesheet_ids, context=context)
+ return res
+
+class hr_timesheet_sheet(osv.osv):
+ _inherit = "hr_timesheet_sheet.sheet"
+ _columns = {
+ 'timesheet_week_ids' : fields.one2many('hr.timesheet.week', 'sheet_id', 'Timesheet Week lines',
+ readonly=True, states={
+ 'draft': [('readonly', False)],
+ 'new': [('readonly', False)]}
+ ),
+ }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_timesheet_sheet/static/src/css'
=== added file 'hr_timesheet_sheet/static/src/css/timesheet.css'
=== added file 'hr_timesheet_sheet/static/src/img/project.png'
Binary files hr_timesheet_sheet/static/src/img/project.png 1970-01-01 00:00:00 +0000 and hr_timesheet_sheet/static/src/img/project.png 2012-09-25 06:16:26 +0000 differ
=== added file 'hr_timesheet_sheet/static/src/img/remove.png'
Binary files hr_timesheet_sheet/static/src/img/remove.png 1970-01-01 00:00:00 +0000 and hr_timesheet_sheet/static/src/img/remove.png 2012-09-25 06:16:26 +0000 differ
=== added file 'hr_timesheet_sheet/static/src/img/save.png'
Binary files hr_timesheet_sheet/static/src/img/save.png 1970-01-01 00:00:00 +0000 and hr_timesheet_sheet/static/src/img/save.png 2012-09-25 06:16:26 +0000 differ
=== added file 'hr_timesheet_sheet/static/src/img/timesheetcontrols.gif'
Binary files hr_timesheet_sheet/static/src/img/timesheetcontrols.gif 1970-01-01 00:00:00 +0000 and hr_timesheet_sheet/static/src/img/timesheetcontrols.gif 2012-09-25 06:16:26 +0000 differ
=== added directory 'hr_timesheet_sheet/static/src/js'
=== added file 'hr_timesheet_sheet/static/src/js/timesheet.js'
--- hr_timesheet_sheet/static/src/js/timesheet.js 1970-01-01 00:00:00 +0000
+++ hr_timesheet_sheet/static/src/js/timesheet.js 2012-09-25 06:16:26 +0000
@@ -0,0 +1,30 @@
+/*
+TODO:
+
+ * pager in day view
+
+ * header/footer in week, day view
+
+ * In week view, by defaults, all records in editable if edit mode
+
+*/
+openerp.hr_timesheet_sheet = function(instance){
+ instance.hr_timesheet_sheet = instance.web.ListView.include({
+ on_loaded: function(data, grouped) {
+ this._super(data, grouped)
+ if(this.model == "hr.analytic.timesheet" && this.fields_view.type != "tree")
+ {
+ var daylist = instance.web.qweb.render('HROne2Many.listview');
+ $(daylist).insertBefore(this.$el.find('.oe_list_header_columns'));
+ this.$el.find(".day_previous").on('click', _.bind(this.day_previous,this));
+ this.$el.find(".day_next").on('click', _.bind(this.day_next,this));
+ }
+ },
+ day_next: function() {
+ console.log('Next' , this.records.records)
+ },
+ day_previous: function() {
+ console.log('Previous' , this);
+ }
+ })
+}
\ No newline at end of file
=== added directory 'hr_timesheet_sheet/static/src/xml'
=== added file 'hr_timesheet_sheet/static/src/xml/timesheet.xml'
--- hr_timesheet_sheet/static/src/xml/timesheet.xml 1970-01-01 00:00:00 +0000
+++ hr_timesheet_sheet/static/src/xml/timesheet.xml 2012-09-25 06:16:26 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vim:fdl=1: -->
+<templates id="template" xml:space="preserve">
+ <t t-name="HROne2Many.listview">
+ <tr style="background-color:white">
+ <td><a class="day_previous">Previous</a></td>
+ <td><a class="day_next">Next</a></td>
+ </tr>
+ </t>
+</templates>
\ No newline at end of file
=== modified file 'mail/static/src/js/mail.js'
--- mail/static/src/js/mail.js 2012-09-18 15:05:44 +0000
+++ mail/static/src/js/mail.js 2012-09-25 06:16:26 +0000
@@ -294,6 +294,7 @@
this.records = {};
this.ds_thread = new session.web.DataSetSearch(this, this.context.default_model);
this.ds_notification = new session.web.DataSetSearch(this, 'mail.notification');
+ this.ds_notif = new session.web.DataSetSearch(this, 'mail.notification');
this.ds_message = new session.web.DataSetSearch(this, 'mail.message');
},
@@ -345,11 +346,30 @@
// event: click on 'Delete' in msg side menu
this.$el.on('click', 'a.oe_mail_msg_delete', this.on_message_delete);
// event: click on 'Hide' in msg side menu
+<<<<<<< TREE
this.$el.on('click', 'a.oe_mail_msg_hide', this.on_message_read);
// event: click on 'Reply by email' in msg side menu
+=======
+ this.$el.on('click', 'a.oe_mail_msg_hide', function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+ //var msg_id = event.srcElement.dataset.id;
+ var msg_id = event.target.dataset.id || event.srcElement.dataset.id;
+ if (! msg_id) return false;
+ $(event.target || event.srcElement).parents('li.oe_mail_thread_msg').eq(0).remove();
+ return self.ds_notif.call('set_message_read', [parseInt(msg_id)]);
+ });
+ // event: click on "Reply by email" in msg side menu (email style)
+>>>>>>> MERGE-SOURCE
this.$el.on('click', 'a.oe_mail_msg_reply_by_email', function (event) {
+<<<<<<< TREE
if (! self.compose_message_widget) return true;
var msg_id = event.srcElement.dataset.msg_id;
+=======
+ event.preventDefault();
+ event.stopPropagation();
+ var msg_id = event.target.dataset.msg_id || event.srcElement.dataset.msg_id;
+>>>>>>> MERGE-SOURCE
if (! msg_id) return false;
self.compose_message_widget.refresh({
'default_composition_mode': 'reply',
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp