summaryrefslogtreecommitdiff
path: root/addons/project_timesheet
diff options
context:
space:
mode:
authorVijaykumar Baladaniya <vba@tinyerp.com>2012-07-09 18:31:13 +0530
committerVijaykumar Baladaniya <vba@tinyerp.com>2012-07-09 18:31:13 +0530
commitbe2e95656aaa113addea2b510fcdcf2f890eaaa4 (patch)
treeabcb3dd4ef350a1b8ad0eaffdd2b9a1cb91521af /addons/project_timesheet
parentb982ea278b33132def3927417b7a854b98b5028a (diff)
parent3925f76ce85854e5d4834902a05f57bcfc5ace85 (diff)
[MERGE]merged with trunk-survey-layout-tta
bzr revid: vba@tinyerp.com-20120709130113-3lchipgil9oqpglg
Diffstat (limited to 'addons/project_timesheet')
-rw-r--r--addons/project_timesheet/__openerp__.py8
-rw-r--r--addons/project_timesheet/process/project_timesheet_process.xml2
-rw-r--r--addons/project_timesheet/project_timesheet.py40
-rw-r--r--addons/project_timesheet/project_timesheet_view.xml28
-rw-r--r--addons/project_timesheet/report/task_report_view.xml12
-rw-r--r--addons/project_timesheet/security/project_timesheet_security.xml9
6 files changed, 33 insertions, 66 deletions
diff --git a/addons/project_timesheet/__openerp__.py b/addons/project_timesheet/__openerp__.py
index 2dccbb2e38b..f1a82867a6f 100644
--- a/addons/project_timesheet/__openerp__.py
+++ b/addons/project_timesheet/__openerp__.py
@@ -36,7 +36,13 @@ the Timesheet line entries for particular date and particular user with the eff
'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'],
'depends': ['project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'],
'init_xml': ['project_timesheet_data.xml'],
- 'update_xml': ["security/ir.model.access.csv","process/project_timesheet_process.xml", "report/task_report_view.xml", "project_timesheet_view.xml"],
+ 'update_xml': [
+ "security/ir.model.access.csv",
+ "security/project_timesheet_security.xml",
+ "process/project_timesheet_process.xml",
+ "report/task_report_view.xml",
+ "project_timesheet_view.xml",
+ ],
'demo_xml': ["project_timesheet_demo.xml"],
'test': [
'test/worktask_entry_to_timesheetline_entry.yml',
diff --git a/addons/project_timesheet/process/project_timesheet_process.xml b/addons/project_timesheet/process/project_timesheet_process.xml
index aea15d814c1..755560d947b 100644
--- a/addons/project_timesheet/process/project_timesheet_process.xml
+++ b/addons/project_timesheet/process/project_timesheet_process.xml
@@ -2,7 +2,7 @@
<openerp>
<data>
- <!--
+ <!--
Process Node
-->
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index 585b3cd6ec8..565710f5664 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -50,14 +50,10 @@ class project_project(osv.osv):
return res
_columns = {
- 'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"),
'amount_to_invoice': fields.function(_to_invoice, string="Amount to Invoice", multi="sums"),
'time_to_invoice': fields.function(_to_invoice, string="Time to Invoice", multi="sums"),
'timesheet_count': fields.function(_timesheet_count, type='integer', string="Issue"),
}
- _defaults = {
- 'use_timesheets': True,
- }
def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
res = super(project_project, self).onchange_partner_id(cr, uid, ids, part, context)
@@ -69,28 +65,6 @@ class project_project(osv.osv):
factor_id = data_obj.browse(cr, uid, data_id).res_id
res['value'].update({'to_invoice': factor_id})
return res
-
- 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,
- }
- return {
- 'type': 'ir.actions.act_window',
- 'name': _('Bill Tasks Works'),
- 'res_model': 'account.analytic.line',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'context': view_context,
- 'nodestroy': True,
- }
project_project()
@@ -131,7 +105,7 @@ class project_work(osv.osv):
project_obj = self.pool.get('project.project')
task_obj = self.pool.get('project.task')
uom_obj = self.pool.get('product.uom')
-
+
vals_line = {}
context = kwargs.get('context', {})
if not context.get('no_analytic_entry',False):
@@ -141,7 +115,7 @@ class project_work(osv.osv):
vals_line['user_id'] = vals['user_id']
vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
-
+
#calculate quantity based on employee's product's uom
vals_line['unit_amount'] = vals['hours']
@@ -179,7 +153,7 @@ class project_work(osv.osv):
project_obj = self.pool.get('project.project')
uom_obj = self.pool.get('product.uom')
result = {}
-
+
if isinstance(ids, (long, int)):
ids = [ids,]
@@ -194,11 +168,11 @@ class project_work(osv.osv):
vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/')
if 'user_id' in vals:
vals_line['user_id'] = vals['user_id']
- result = self.get_user_related_details(cr, uid, vals['user_id'])
+ result = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id))
for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
if result.get(fld, False):
vals_line[fld] = result[fld]
-
+
if 'date' in vals:
vals_line['date'] = vals['date'][:10]
if 'hours' in vals:
@@ -208,7 +182,7 @@ class project_work(osv.osv):
if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
-
+
# Compute based on pricetype
amount_unit = timesheet_obj.on_change_unit_amount(cr, uid, line_id.id,
prod_id=prod_id, company_id=False,
@@ -218,7 +192,7 @@ class project_work(osv.osv):
vals_line['amount'] = amount_unit['value']['amount']
self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
-
+
return super(project_work,self).write(cr, uid, ids, vals, context)
def unlink(self, cr, uid, ids, *args, **kwargs):
diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml
index 8b6aa992366..2e2ec7f2677 100644
--- a/addons/project_timesheet/project_timesheet_view.xml
+++ b/addons/project_timesheet/project_timesheet_view.xml
@@ -1,28 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
- <record id="project_invoice_form" model="ir.ui.view">
- <field name="name">Inherit project form : Invoicing Data</field>
- <field name="model">project.project</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="project.edit_project"/>
- <field name="arch" type="xml">
- <field name="use_tasks" position='after'>
- <field name="use_timesheets"/>
- <field name="amount_to_invoice" invisible="True"/>
- <field name="time_to_invoice" invisible="True"/>
- </field>
- <field name="warn_customer" position="after">
- <group colspan="4" col="4">
- <separator colspan="4" string="Invoicing Data"/>
- <field name="pricelist_id" groups="product.group_sale_pricelist" domain="[('type','=','sale')]" widget="selection"/>
- <field name="to_invoice" widget="selection" string="Invoice Task Work"/>
- <field name="amount_max"/>
- <field name="amount_invoiced"/>
- </group>
- </field>
- </field>
- </record>
<record id="view_project_kanban_inherited" model="ir.ui.view">
<field name="name">project.project.kanban.inherited</field>
@@ -55,10 +33,10 @@
<field name="name">Inherit project form : Customer</field>
<field name="model">project.project</field>
<field name="type">form</field>
- <field name="inherit_id" ref="project_invoice_form"/>
+ <field name="inherit_id" ref="analytic_contract_project.project_invoice_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="replace">
- <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" string="Customer" attrs="{'required':[('to_invoice','!=',False)]}"/>
+ <field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Customer" attrs="{'required':[('to_invoice','!=',False)]}"/>
</field>
</field>
</record>
@@ -115,7 +93,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
- <field name="context">{}</field>
+ <field name="context">{'search_default_to_invoice': 1}</field>
<field name="view_id" ref="view_account_analytic_line_tree_inherit_account_id"/>
<field name="help">You will find here all works made on tasks that you can invoice.
In order to invoice the time spent on a project, you must define the
diff --git a/addons/project_timesheet/report/task_report_view.xml b/addons/project_timesheet/report/task_report_view.xml
index 66633fe8ad8..6bc424ce60c 100644
--- a/addons/project_timesheet/report/task_report_view.xml
+++ b/addons/project_timesheet/report/task_report_view.xml
@@ -9,16 +9,16 @@
<!-- Report for Users' Timesheet and Task Hours per Month -->
- <record id="view_report_timesheet_task_user_tree" model="ir.ui.view">
+ <record id="view_report_timesheet_task_user_tree" model="ir.ui.view">
<field name="name">report.timesheet.task.user.tree</field>
<field name="model">report.timesheet.task.user</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Timesheet/Task hours Report Per Month" >
- <field name="name" select="1"/>
- <field name="year" select="1" invisible="1"/>
- <field name="month" select="1" invisible="1"/>
- <field name="user_id" select="1"/>
+ <field name="name"/>
+ <field name="year" invisible="1"/>
+ <field name="month" invisible="1"/>
+ <field name="user_id"/>
<field name="timesheet_hrs" widget="float_time" />
<field name="task_hrs" widget="float_time"/>
</tree>
@@ -33,7 +33,7 @@
<group>
<field name="name" string="Date"/>
<separator orientation="vertical"/>
- <field name="user_id"/>
+ <field name="user_id"/>
</group>
<newline/>
<group expand="1" string="Group By...">
diff --git a/addons/project_timesheet/security/project_timesheet_security.xml b/addons/project_timesheet/security/project_timesheet_security.xml
new file mode 100644
index 00000000000..ea1f0a98b4c
--- /dev/null
+++ b/addons/project_timesheet/security/project_timesheet_security.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="0">
+ <record model="res.groups" id="base.group_user">
+ <field name="implied_ids" eval="[(4, ref('project.group_tasks_work_on_tasks'))]"/>
+ </record>
+ </data>
+</openerp>
+