@@ -58,7 +64,7 @@
-
+
@@ -83,7 +89,7 @@
-
+
@@ -109,7 +115,8 @@
tree
-
+
+
diff --git a/addons/project/project.py b/addons/project/project.py
index 0b23196a67f..51d254756f4 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -198,10 +198,8 @@ class project(osv.osv):
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
- 'use_tasks': fields.boolean('Use Tasks', help="Check this field if this project is aimed at managing tasks"),
'task_count': fields.function(_task_count, type='integer', string="Open Tasks"),
'color': fields.integer('Color Index'),
- 'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}
def dummy(self, cr, uid, ids, context):
@@ -217,7 +215,6 @@ class project(osv.osv):
'priority': 1,
'sequence': 10,
'type_ids': _get_type_common,
- 'use_tasks': True,
}
# TODO: Why not using a SQL contraints ?
@@ -1234,16 +1231,35 @@ class project_work(osv.osv):
project_work()
class account_analytic_account(osv.osv):
-
_inherit = 'account.analytic.account'
_description = 'Analytic Account'
+ _columns = {
+ 'use_tasks': fields.boolean('Tasks Management'),
+ 'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
+ }
+# _defaults = {
+# 'use_tasks': True,
+# }
+
+ def project_create(self,cr,uid,analytic_account_id,vals,context=None):
+ res = {}
+ project_pool = self.pool.get('project.project')
+ project_id = project_pool.name_search(cr, uid, name=vals.get('name'))
+ if not project_id:
+ res['name'] = vals.get('name')
+ res['analytic_account_id'] = analytic_account_id
+ project_pool.create(cr, uid, res, context=context)
+ return True
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)
+ analytic_account_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
+ if vals.get('use_tasks', False):
+ self.project_create(cr, uid, analytic_account_id, vals, context)
+ return analytic_account_id
def unlink(self, cr, uid, ids, *args, **kwargs):
project_obj = self.pool.get('project.project')
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 70cdac1efa0..29704cf3318 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -600,6 +600,22 @@
+
+
+ account.analytic.account.form.inherit
+ account.analytic.account
+ form
+
+
+
+
+
+
+
+
+
+
+
Tasks
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 176ffa61acd..d49631fb771 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -512,14 +512,9 @@ class project(osv.osv):
_columns = {
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'reply_to' : fields.char('Reply-To Email Address', size=256),
- 'use_issues' : fields.boolean('Use Issues', help="Check this field if this project manages issues"),
'issue_count': fields.function(_issue_count, type='integer'),
}
- _defaults = {
- 'use_issues': True,
- }
-
def _check_escalation(self, cr, uid, ids, context=None):
project_obj = self.browse(cr, uid, ids[0], context=context)
if project_obj.project_escalation_id:
@@ -532,4 +527,26 @@ class project(osv.osv):
]
project()
+class account_analytic_account(osv.osv):
+
+ _inherit = 'account.analytic.account'
+ _description = 'Analytic Account'
+
+ _columns = {
+ 'use_issues' : fields.boolean('Issue Tracking:', help="Check this field if this project manages issues"),
+ }
+# _defaults = {
+# 'use_issues': True,
+# }
+
+ def create(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
+ obj_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
+ if vals.get('use_issues', False):
+ self.project_create(cr, uid, obj_id, vals, context)
+ return obj_id
+
+account_analytic_account()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 716a02f2f60..99b4ecafc57 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -387,5 +387,20 @@
+
+ account.analytic.account.issue.form.inherit
+ account.analytic.account
+ form
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 19d58f101ef..11ecdd940f9 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -225,13 +225,9 @@ class project(osv.osv):
_columns = {
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
- 'use_phases': fields.boolean('Use Phases', help="Check this field if project manages phases"),
'phase_count': fields.function(_phase_count, type='integer', string="Open Phases"),
}
- _defaults = {
- 'use_phases': True,
- }
-
+
def schedule_phases(self, cr, uid, ids, context=None):
context = context or {}
if type(ids) in (long, int,):
@@ -273,6 +269,24 @@ class project(osv.osv):
return True
project()
+class account_analytic_account(osv.osv):
+ _inherit = 'account.analytic.account'
+ _description = 'Analytic Account'
+ _columns = {
+ 'use_phases': fields.boolean('Phases Planing', help="Check this field if project manages phases"),
+ }
+# _defaults = {
+# 'use_phases': True,
+# }
+ def create(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
+ obj_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
+ if vals.get('use_phases', False):
+ self.project_create(cr, uid, obj_id, vals, context)
+ return obj_id
+account_analytic_account()
+
class project_task(osv.osv):
_inherit = "project.task"
_columns = {
diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml
index 1e9f50cdd87..2d7412f7e7d 100644
--- a/addons/project_long_term/project_long_term_view.xml
+++ b/addons/project_long_term/project_long_term_view.xml
@@ -368,6 +368,22 @@
src_model="project.phase"
view_mode="tree,form"
/>
+
+
+ account.analytic.account.phase.form.inherit
+ account.analytic.account
+ form
+
+
+
+
+
+
+
+
+
+
+
# ------------------------------------------------------
# Menu Items