Merge lp:~camptocamp/openobject-addons/trunk-fix-1178617 into lp:openobject-addons

Proposed by Yannick Vaucher @ Camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/trunk-fix-1178617
Merge into: lp:openobject-addons
Diff against target: 36 lines (+22/-1)
1 file modified
hr_timesheet/hr_timesheet.py (+22/-1)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/trunk-fix-1178617
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+170348@code.launchpad.net

Description of the change

Patch taken from code of hr_timesheet_improvement

To post a comment you must log in.

Unmerged revisions

8777. By Yannick Vaucher @ Camptocamp on 2013-06-19

[FIX] hr_timesheet - details tab must be sorted by date

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hr_timesheet/hr_timesheet.py'
2--- hr_timesheet/hr_timesheet.py 2013-04-29 15:14:10 +0000
3+++ hr_timesheet/hr_timesheet.py 2013-06-19 13:19:06 +0000
4@@ -69,10 +69,31 @@
5 _table = 'hr_analytic_timesheet'
6 _description = "Timesheet Line"
7 _inherits = {'account.analytic.line': 'line_id'}
8- _order = "id desc"
9+ _order = "date_aal DESC, account_name ASC"
10+
11+ def _get_account_analytic_line(self, cr, uid, ids, context=None):
12+ ts_line_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [('line_id', 'in', ids)])
13+ return ts_line_ids
14+
15+ def _get_account_analytic_account(self, cr, uid, ids, context=None):
16+ ts_line_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [('account_id', 'in', ids)])
17+ return ts_line_ids
18+
19 _columns = {
20 'line_id': fields.many2one('account.analytic.line', 'Analytic Line', ondelete='cascade', required=True),
21 'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner', relation='res.partner', store=True),
22+
23+ 'date_aal': fields.related('line_id', 'date', string="Analytic Line Date", type='date',
24+ store={
25+ 'account.analytic.line': (_get_account_analytic_line, ['date'], 10),
26+ 'hr.analytic.timesheet': (lambda self,cr,uid,ids,context=None: ids, None, 10),
27+ }),
28+ 'account_name': fields.related('account_id', 'name', string="Analytic Account Name", type='char', size=256,
29+ store={
30+ 'account.analytic.account': (_get_account_analytic_account, ['name'], 10),
31+ 'hr.analytic.timesheet': (lambda self,cr,uid,ids,context=None: ids, None, 10),
32+ }
33+ ),
34 }
35
36 def unlink(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches

to all changes: