remove allocations model
This commit is contained in:
parent
099857d63c
commit
970a81713e
|
@ -11,7 +11,6 @@ def register():
|
|||
ProjectResourcePlanStart,
|
||||
ProjectResourcePlanTasks,
|
||||
PredecessorSuccessor,
|
||||
Allocation,
|
||||
ResourceBooking,
|
||||
module='project_resource_plan', type_='model')
|
||||
Pool.register(
|
||||
|
|
|
@ -161,22 +161,13 @@ Create a Project::
|
|||
Create allocations and set predecessors and successors::
|
||||
|
||||
>>> task_1 = ProjectWork(task_1.id)
|
||||
>>> allocation = task_1.allocations.new()
|
||||
>>> allocation.employee = employee
|
||||
>>> allocation.percentage = 50.0
|
||||
>>> allocation = task_1.allocations.new()
|
||||
>>> allocation.employee = second_employee
|
||||
>>> allocation.percentage = 50.0
|
||||
>>> task_1.assigned_employee = employee
|
||||
>>> task_1.save()
|
||||
>>> allocation = task_2.allocations.new()
|
||||
>>> allocation.employee = employee
|
||||
>>> allocation.percentage = 100.0
|
||||
>>> task_2.assigned_employee = employee
|
||||
>>> task_1 = ProjectWork(task_1.id)
|
||||
>>> task_2.predecessors.append(task_1)
|
||||
>>> task_2.save()
|
||||
>>> allocation = task_3.allocations.new()
|
||||
>>> allocation.employee = second_employee
|
||||
>>> allocation.percentage = 100.0
|
||||
>>> task_3.assigned_employee = second_employee
|
||||
>>> task_2 = ProjectWork(task_2.id)
|
||||
>>> task_3.predecessors.append(task_2)
|
||||
>>> task_3.save()
|
||||
|
@ -195,7 +186,7 @@ Plan all the tasks::
|
|||
... today, datetime.time(9, 00))
|
||||
True
|
||||
>>> project.planned_end_date_project == datetime.datetime.combine(
|
||||
... add_days_without_weekend(today,2), datetime.time(17, 00))
|
||||
... add_days_without_weekend(today,0), datetime.time(17, 00))
|
||||
True
|
||||
>>> task_1.reload()
|
||||
>>> task_1.planned_start_date == datetime.datetime.combine(
|
||||
|
@ -280,15 +271,11 @@ Plan two tasks in the same day::
|
|||
>>> task.effort = 4
|
||||
>>> project.save()
|
||||
>>> _, _, _, task_4, task_5 = project.children
|
||||
>>> allocation = task_4.allocations.new()
|
||||
>>> allocation.employee = second_employee
|
||||
>>> allocation.percentage = 100.0
|
||||
>>> task_4.assigned_employee = second_employee
|
||||
>>> task_1 = ProjectWork(task_1.id)
|
||||
>>> task_4.predecessors.append(task_1)
|
||||
>>> task_4.save()
|
||||
>>> allocation = task_5.allocations.new()
|
||||
>>> allocation.employee = second_employee
|
||||
>>> allocation.percentage = 100.0
|
||||
>>> task_5.assigned_employee = second_employee
|
||||
>>> task_1 = ProjectWork(task_1.id)
|
||||
>>> task_5.predecessors.append(task_1)
|
||||
>>> task_5.save()
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Allocation">
|
||||
<label name="employee"/>
|
||||
<field name="employee"/>
|
||||
<label name="percentage"/>
|
||||
<field name="percentage"/>
|
||||
<label name="work"/>
|
||||
<field name="work"/>
|
||||
</form>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Allocations" editable="top">
|
||||
<field name="employee"/>
|
||||
<field name="percentage"/>
|
||||
<field name="work"/>
|
||||
</tree>
|
|
@ -23,7 +23,8 @@
|
|||
</page>
|
||||
<page string="Allocations" id="allocations"
|
||||
states="{'invisible': Not(Equal(Eval('type'), 'task'))}" >
|
||||
<field name="allocations" colspan="4"/>
|
||||
<label name="planned_employee"/>
|
||||
<field name="planned_employee"/>
|
||||
<field name="bookings" colspan="4"/>
|
||||
</page>
|
||||
</xpath>
|
||||
|
|
20
work.py
20
work.py
|
@ -8,7 +8,7 @@ from trytond.pyson import Eval, PYSONDecoder, PYSONEncoder
|
|||
from trytond.wizard import Wizard, StateAction, StateView, Button
|
||||
from trytond.rpc import RPC
|
||||
|
||||
__all__ = ['Work', 'Allocation', 'PredecessorSuccessor',
|
||||
__all__ = ['Work', 'PredecessorSuccessor',
|
||||
'ProjectResourcePlanStart', 'ProjectResourcePlanTasks',
|
||||
'ProjectResourcePlan']
|
||||
|
||||
|
@ -200,8 +200,8 @@ class Work:
|
|||
})
|
||||
|
||||
def get_assigned_employee(self, name):
|
||||
if self.allocations:
|
||||
return self.allocations[0].employee.id
|
||||
if self.assigned_employee:
|
||||
return self.assigned_employee
|
||||
|
||||
@classmethod
|
||||
def set_assigned_employee(cls, works, name, value):
|
||||
|
@ -242,19 +242,6 @@ class PredecessorSuccessor(ModelSQL):
|
|||
'search_read': RPC(True),
|
||||
})
|
||||
|
||||
|
||||
class Allocation(ModelSQL, ModelView):
|
||||
'Allocation'
|
||||
__name__ = 'project.allocation'
|
||||
_rec_name = 'employee'
|
||||
employee = fields.Many2One('company.employee', 'Employee', required=True,
|
||||
select=True, ondelete='CASCADE')
|
||||
work = fields.Many2One('project.work', 'Work', required=True,
|
||||
select=True, ondelete='CASCADE')
|
||||
percentage = fields.Float('Percentage', digits=(16, 2), required=True,
|
||||
domain=[('percentage', '>', 0.0)])
|
||||
|
||||
|
||||
class ProjectResourcePlanStart(ModelView):
|
||||
'Project Resource Plan Start'
|
||||
__name__ = 'project.resource.plan.start'
|
||||
|
@ -339,7 +326,6 @@ class ProjectResourcePlan(Wizard):
|
|||
def do_plan(self, action):
|
||||
pool = Pool()
|
||||
Work = pool.get('project.work')
|
||||
Allocation = pool.get('project.allocation')
|
||||
Booking = pool.get('resource.booking')
|
||||
|
||||
if self.start.delete_drafts:
|
||||
|
|
12
work.xml
12
work.xml
|
@ -13,17 +13,7 @@
|
|||
<field name="user" ref="res.user_trigger"/>
|
||||
<field name="group" ref="group_project_resource_plan"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="allocation_view_form">
|
||||
<field name="model">project.allocation</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">allocation_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="allocation_view_tree">
|
||||
<field name="model">project.allocation</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="name">allocation_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="resource_plan_start_view_form">
|
||||
<field name="model">project.resource.plan.start</field>
|
||||
<field name="type">form</field>
|
||||
|
|
Loading…
Reference in New Issue