[IMP] project: Remove field use_tasks
Purpose ======= This isn't useful now that project issues and tasks have been merged. Specification ============= Keep the label field, remove the checkbox
This commit is contained in:
@@ -17,7 +17,7 @@ class CrmLeadConvert2Task(models.TransientModel):
|
||||
return result
|
||||
|
||||
lead_id = fields.Many2one('crm.lead', string='Lead', domain=[('type', '=', 'lead')])
|
||||
project_id = fields.Many2one('project.project', string='Project', domain=[('use_tasks', '=', True)])
|
||||
project_id = fields.Many2one('project.project', string='Project')
|
||||
|
||||
@api.multi
|
||||
def action_lead_to_project_task(self):
|
||||
|
||||
@@ -13,7 +13,6 @@ class TestTimesheet(TransactionCase):
|
||||
self.project_customer = self.env['project.project'].create({
|
||||
'name': 'Project X',
|
||||
'allow_timesheets': True,
|
||||
'use_tasks': True,
|
||||
})
|
||||
self.task1 = self.env['project.task'].create({
|
||||
'name': 'Task One',
|
||||
|
||||
@@ -27,10 +27,7 @@
|
||||
<field name="inherit_id" ref="project.project_project_view_form_simplified"/>
|
||||
<field name="priority">24</field>
|
||||
<field name="arch" type="xml">
|
||||
<group name="options" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</group>
|
||||
<field name="use_tasks" position="after">
|
||||
<field name="user_id" position="after">
|
||||
<field name="allow_timesheets"/>
|
||||
</field>
|
||||
</field>
|
||||
@@ -115,7 +112,7 @@
|
||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||
<field name="priority">24</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="use_tasks" position="after">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="allow_timesheets" invisible="1"/>
|
||||
</field>
|
||||
<xpath expr="//div[hasclass('o_kanban_manage_reports')]/div[last()]" position="after">
|
||||
|
||||
@@ -166,12 +166,6 @@ class Project(models.Model):
|
||||
def _get_default_favorite_user_ids(self):
|
||||
return [(6, 0, [self.env.uid])]
|
||||
|
||||
@api.model
|
||||
def default_get(self, flds):
|
||||
result = super(Project, self).default_get(flds)
|
||||
result['use_tasks'] = True
|
||||
return result
|
||||
|
||||
active = fields.Boolean(default=True,
|
||||
help="If the active field is set to False, it will allow you to hide the project without removing it.")
|
||||
sequence = fields.Integer(default=10, help="Gives the sequence order when displaying a list of Projects.")
|
||||
@@ -256,7 +250,7 @@ class Project(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
# Prevent double project creation when 'use_tasks' is checked
|
||||
# Prevent double project creation
|
||||
self = self.with_context(project_creation_in_progress=True, mail_create_nosubscribe=True)
|
||||
project = super(Project, self).create(vals)
|
||||
if not vals.get('subtask_project_id'):
|
||||
@@ -878,7 +872,6 @@ class AccountAnalyticAccount(models.Model):
|
||||
_inherit = 'account.analytic.account'
|
||||
_description = 'Analytic Account'
|
||||
|
||||
use_tasks = fields.Boolean(string='Use Tasks', help="Check this box to manage internal activities through this project")
|
||||
company_uom_id = fields.Many2one('product.uom', related='company_id.project_time_mode_id', string="Company UOM")
|
||||
project_ids = fields.One2many('project.project', 'analytic_account_id', string='Projects')
|
||||
project_count = fields.Integer(compute='_compute_project_count', string='Project Count')
|
||||
@@ -892,7 +885,7 @@ class AccountAnalyticAccount(models.Model):
|
||||
'''
|
||||
This function is used to decide if a project needs to be automatically created or not when an analytic account is created. It returns True if it needs to be so, False otherwise.
|
||||
'''
|
||||
return vals.get('use_tasks') and 'project_creation_in_progress' not in self.env.context
|
||||
return 'project_creation_in_progress' not in self.env.context
|
||||
|
||||
@api.multi
|
||||
def project_create(self, vals):
|
||||
@@ -906,7 +899,6 @@ class AccountAnalyticAccount(models.Model):
|
||||
project_values = {
|
||||
'name': vals.get('name'),
|
||||
'analytic_account_id': self.id,
|
||||
'use_tasks': True,
|
||||
}
|
||||
return Project.create(project_values).id
|
||||
return False
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<a t-attf-href="/my/project/#{project.id}?{{ keep_query() }}"><span t-field="project.name"/></a>
|
||||
</td>
|
||||
<td>
|
||||
<a t-if="project.use_tasks" t-attf-href="/my/tasks?{{keep_query('debug', filterby=project.id)}}">
|
||||
<a t-attf-href="/my/tasks?{{keep_query('debug', filterby=project.id)}}">
|
||||
<t t-esc="project.task_count" />
|
||||
<t t-esc="project.label_tasks" />
|
||||
</a>
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<button class="oe_stat_button" name="attachment_tree_view" type="object" icon="fa-files-o">
|
||||
<field string="Documents" name="doc_count" widget="statinfo"/>
|
||||
</button>
|
||||
<button class="oe_stat_button" type="action" attrs="{'invisible':[('use_tasks','=', False)]}"
|
||||
<button class="oe_stat_button" type="action"
|
||||
name="%(act_project_project_2_project_task_all)d" icon="fa-tasks">
|
||||
<field string="Tasks" name="task_count" widget="statinfo" options="{'label_field': 'label_tasks'}"/>
|
||||
</button>
|
||||
@@ -126,9 +126,8 @@
|
||||
</h1>
|
||||
<div name="options_active" class="oe_edit_only">
|
||||
<div>
|
||||
<field name="use_tasks" class="oe_inline"/>
|
||||
<label for="use_tasks" class="oe_inline" string="Name of the tasks :"/>
|
||||
<field name="label_tasks" class="oe_inline oe_input_align" attrs="{'invisible': [('use_tasks', '=', False)]}"/>
|
||||
<label for="label_tasks" class="oe_inline" string="Name of the tasks :"/>
|
||||
<field name="label_tasks" class="oe_inline oe_input_align"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,9 +224,6 @@
|
||||
</div>
|
||||
<field name="user_id" invisible="1"/>
|
||||
</group>
|
||||
<group name='options' invisible="1">
|
||||
<field name="use_tasks"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Create" name="close_dialog" type="object" class="btn-primary"/>
|
||||
@@ -256,7 +252,6 @@
|
||||
<kanban class="oe_background_grey o_kanban_dashboard o_project_kanban" on_create="project.open_create_project">
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="use_tasks"/>
|
||||
<field name="color"/>
|
||||
<field name="task_count"/>
|
||||
<field name="task_needaction_count"/>
|
||||
@@ -286,7 +281,7 @@
|
||||
<div groups="project.group_project_manager">
|
||||
<a type="edit">Settings</a>
|
||||
</div>
|
||||
<div attrs="{'invisible': [('use_tasks', '=', False)]}">
|
||||
<div>
|
||||
<a name="%(project.action_project_task_user_tree_filtered)d" type="action">Tasks</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -301,7 +296,7 @@
|
||||
</div>
|
||||
|
||||
<div class="o_project_kanban_boxes">
|
||||
<div t-if="record.use_tasks.raw_value" class="o_project_kanban_box">
|
||||
<div class="o_project_kanban_box">
|
||||
<a name="%(act_project_project_2_project_task_all)d" type="action">
|
||||
<span class="o_value"><t t-esc="record.task_count.value"/></span>
|
||||
<span class="o_label"><t t-esc="record.label_tasks.value"/></span>
|
||||
@@ -395,7 +390,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="project_id" domain="[('active', '=', True)]" context="{'default_use_tasks':1}"/>
|
||||
<field name="project_id" domain="[('active', '=', True)]"/>
|
||||
<field name="user_id"
|
||||
class="o_task_user_field"
|
||||
options='{"no_open": True}'/>
|
||||
@@ -604,10 +599,6 @@
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||
<field eval="18" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr='//div[@name="project"]' position='inside'>
|
||||
<field name="use_tasks" groups="base.group_no_one"/>
|
||||
<label for="use_tasks" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='toggle_active']" position="before">
|
||||
<button class="oe_stat_button" type="object" name="projects_action"
|
||||
icon="fa-puzzle-piece" attrs="{'invisible': [('project_count', '=', 0)]}">
|
||||
|
||||
@@ -107,6 +107,5 @@ class Project(models.Model):
|
||||
action['name'] = _('Ratings of %s') % (self.name,)
|
||||
action_context = safe_eval(action['context']) if action['context'] else {}
|
||||
action_context.update(self._context)
|
||||
if self.use_tasks:
|
||||
action_context['search_default_rating_tasks'] = 1
|
||||
action_context['search_default_rating_tasks'] = 1
|
||||
return dict(action, context=action_context)
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button name="%(rating_rating_action_view_project_rating_task)d"
|
||||
attrs="{'invisible': ['|', '|', ('rating_status', '=', 'no'), ('use_tasks','=', False), ('percentage_satisfaction_task', '=', -1)]}"
|
||||
attrs="{'invisible': ['|', '|', ('rating_status', '=', 'no'), ('percentage_satisfaction_task', '=', -1)]}"
|
||||
class="oe_stat_button oe_percent"
|
||||
type="action"
|
||||
icon="fa-smile-o">
|
||||
@@ -144,7 +144,7 @@
|
||||
<field name="model">project.project</field>
|
||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="use_tasks" position="after">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="percentage_satisfaction_project" invisible="1"/>
|
||||
<field name="rating_status" invisible="1"/>
|
||||
</field>
|
||||
|
||||
@@ -56,7 +56,7 @@ class ProcurementOrder(models.Model):
|
||||
account = self.sale_line_id.order_id.project_id
|
||||
project = Project.search([('analytic_account_id', '=', account.id)], limit=1)
|
||||
if not project:
|
||||
project_id = account.project_create({'name': account.name, 'use_tasks': True})
|
||||
project_id = account.project_create({'name': account.name})
|
||||
project = Project.browse(project_id)
|
||||
return project
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class SaleOrder(models.Model):
|
||||
if line.product_id.track_service == 'timesheet':
|
||||
if not order.project_id:
|
||||
order._create_analytic_account(prefix=line.product_id.default_code or None)
|
||||
order.project_id.project_create({'name': order.project_id.name, 'use_tasks': True})
|
||||
order.project_id.project_create({'name': order.project_id.name})
|
||||
break
|
||||
return result
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from odoo.addons.sale.tests.test_sale_common import TestSale
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare, float_repr
|
||||
from odoo.tools import float_repr
|
||||
|
||||
|
||||
class TestSaleTimesheet(TestSale):
|
||||
@@ -21,7 +21,6 @@ class TestSaleTimesheet(TestSale):
|
||||
self.project = self.env['project.project'].create({
|
||||
'name': 'Project for my timesheets',
|
||||
'allow_timesheets': True,
|
||||
'use_tasks': True,
|
||||
})
|
||||
|
||||
# create service products
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<i class="fa fa-envelope"/> Email : <t t-esc="project.alias_name"/>@<t t-esc="project.alias_domain"/>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div t-if="project.use_tasks" class="col-md-6 text-center">
|
||||
<div class="col-md-6 text-center">
|
||||
<h2><t t-esc="len(project.task_ids)"/></h2>
|
||||
<p><t t-esc="project.label_tasks"/></p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user