[IMP] useability of project view

bzr revid: fp@openerp.com-20120929201326-nt6s4vicmr9ebuu2
This commit is contained in:
Fabien Pinckaers 2012-09-29 22:13:26 +02:00
parent 917ec39f14
commit bf33153a58
2 changed files with 16 additions and 10 deletions

View File

@ -116,10 +116,12 @@
<field name="search_view_id" ref="hr_timesheet_line_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to your timesheets.
Click to record your timesheets.
</p><p>
Through this menu you can register and follow your workings
hours by project every day.
You can register and track your workings hours by project every
day. Every time spent on a project will become a cost in the
analytic accounting and can be re-invoiced to customers if
required.
</p>
</field>
</record>

View File

@ -46,23 +46,27 @@ class project_project(osv.osv):
def open_timesheets(self, cr, uid, ids, context=None):
""" open Timesheets view """
project = self.browse(cr, uid, ids[0], context)
try:
journal_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
except ValueError:
journal_id = False
view_context = {
'search_default_account_id': [project.analytic_account_id.id],
'default_account_id': project.analytic_account_id.id,
'default_journal_id': journal_id,
}
help = _("""<p class="oe_view_nocontent_create">Record your timesheets for the project '%s'.</p>""")
try:
if project.to_invoice and project.partner_id:
help+= _("""<p>Timesheets on this project may be invoiced to %s, according to the terms defined in the contract.</p>""" ) % (project.partner_id.name,)
except:
# if the user do not have access rights on the partner
pass
return {
'type': 'ir.actions.act_window',
'name': _('Bill Tasks Works'),
'res_model': 'account.analytic.line',
'name': _('Timesheets'),
'res_model': 'hr.analytic.timesheet',
'view_type': 'form',
'view_mode': 'tree,form',
'context': view_context,
'nodestroy': True,
'help': help
}
project_project()