diff --git a/addons/project/project.py b/addons/project/project.py
index c5c389e5510..07349e81c4d 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -206,6 +206,7 @@ class project(osv.osv):
result = []
for proj in self.browse(cr, uid, ids, context=context):
parent_id = context.get('parent_id',False) # check me where to pass context for parent id ??
+ context.update({'analytic_project_copy': True})
new_id = project_obj.copy(cr, uid, proj.id, default = {
'name': proj.name +_(' (copy)'),
'state':'open',
@@ -213,13 +214,10 @@ class project(osv.osv):
result.append(new_id)
cr.execute('select id from project_task where project_id=%s', (proj.id,))
res = cr.fetchall()
- for (tasks_id,) in res:
- task_obj.copy(cr, uid, tasks_id, default = {
- 'project_id': new_id,
- 'active':True}, context=context)
- child_ids = self.search(cr, uid, [('parent_id','=', proj.id)], context=context)
+ child_ids = self.search(cr, uid, [('parent_id','=', proj.category_id.id)], context=context)
+ parent_id = self.read(cr, uid, new_id, ['category_id'])['category_id'][0]
if child_ids:
- self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
+ self.duplicate_template(cr, uid, child_ids, context={'parent_id': parent_id})
if result and len(result):
res_id = result[0]
@@ -316,7 +314,7 @@ class task(osv.osv):
'description': fields.text('Description'),
'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Importance'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of tasks."),
- 'type': fields.many2one('project.task.type', 'Stage'),
+ 'type': fields.many2one('project.task.type', 'Stage',),
'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
help='If the task is created the state \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\
\n If the task is over, the states is set to \'Done\'.'),
@@ -626,4 +624,17 @@ class users(osv.osv):
}
users()
+class account_analytic_account(osv.osv):
+
+ _inherit = 'account.analytic.account'
+ _description = 'Analytic Account'
+
+ def create(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
+ if vals.get('child_ids', False) and context.get('analytic_project_copy', False):
+ vals['child_ids'] = []
+ return super(account_analytic_account, self).create(cr, uid, vals, context=context)
+
+account_analytic_account()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 7b299cdcccc..ef7bb92d1d6 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -39,8 +39,8 @@
-
+
@@ -55,11 +55,10 @@
+ states="template" icon="gtk-new" context="{'parent_id':parent_id}"/>
-
@@ -103,6 +102,7 @@
+
@@ -117,7 +117,7 @@
-
+
@@ -129,6 +129,7 @@
+
@@ -493,7 +494,7 @@
diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml
index 9a047fbdd0f..48119f307e0 100644
--- a/addons/project/report/project_report_view.xml
+++ b/addons/project/report/project_report_view.xml
@@ -90,8 +90,8 @@
+ help="My Projects" domain="[('project_id','=',uid)]"/>
+
form
diff --git a/addons/project_gtd/wizard/project_gtd_empty_view.xml b/addons/project_gtd/wizard/project_gtd_empty_view.xml
index ef71ae72978..b39391728a4 100644
--- a/addons/project_gtd/wizard/project_gtd_empty_view.xml
+++ b/addons/project_gtd/wizard/project_gtd_empty_view.xml
@@ -8,10 +8,11 @@
form
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index fd523ad7774..842b61524e7 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -105,6 +105,7 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -158,6 +142,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+