12 changed files with 313 additions and 0 deletions
@ -0,0 +1 @@ |
|||
import models |
@ -0,0 +1,17 @@ |
|||
{ |
|||
'name': 'Task Statusbar', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'website': 'www.cybrosys.com', |
|||
'category': 'Project', |
|||
'version': '0.3', |
|||
'summary': 'Calculates the time spend based on start date and deadline', |
|||
'depends': [ |
|||
'base', |
|||
'project', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/project_statusbar_view.xml', |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,17 @@ |
|||
{ |
|||
'name': 'Task Statusbar', |
|||
'author': 'Nilmar Shereef PT', |
|||
'website': 'www.cybrosys.com', |
|||
'category': 'Project', |
|||
'version': '9.0.0.3', |
|||
'summary': 'Calculates the time spend based on start date and deadline', |
|||
'depends': [ |
|||
'base', |
|||
'project', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/project_statusbar_view.xml', |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1 @@ |
|||
import project_statusbar |
@ -0,0 +1,95 @@ |
|||
from openerp import models, fields, api |
|||
from dateutil.relativedelta import relativedelta |
|||
|
|||
|
|||
class ProjectCustom(models.Model): |
|||
_inherit = 'project.task' |
|||
|
|||
@api.model |
|||
def _check_ami_responsible(self): |
|||
""" Checks if user is responsible for this request |
|||
@return: Dictionary of values |
|||
""" |
|||
flag_poject_manager = self.env['res.users'].has_group('project.group_project_manager') |
|||
flag_project_user = self.env['res.users'].has_group('project.group_project_user') |
|||
for each in self: |
|||
|
|||
if flag_poject_manager: |
|||
each.get_user = True |
|||
elif flag_project_user: |
|||
each.get_user = False |
|||
else: |
|||
each.get_user = False |
|||
|
|||
get_user = fields.Boolean(string='Is Top User', compute=_check_ami_responsible) |
|||
done_time = fields.Datetime(compute='done_date', string="Color") |
|||
progress1 = fields.Integer(string="Working Time Progress(%)", copy=False, readonly=True) |
|||
|
|||
deadline_color = fields.Char(compute='compute_color',) |
|||
task_time = fields.Float(string="Time Range", copy=True) |
|||
date_deadline_ex = fields.Datetime('Deadline', select=True, copy=False, required=True) |
|||
kanban_state = fields.Selection( |
|||
[('normal', 'In Progress'), ('blocked', 'Blocked'), ('done', 'Ready for next stage')], 'Kanban State', |
|||
track_visibility='onchange', |
|||
help="A task's kanban state indicates special situations affecting it:\n" |
|||
" * Normal is the default situation\n" |
|||
" * Blocked indicates something is preventing the progress of this task\n" |
|||
" * Ready for next stage indicates the task is ready to be pulled to the next stage", |
|||
required=False, copy=False) |
|||
|
|||
_defaults = { |
|||
'get_user': True, |
|||
} |
|||
|
|||
def compute_color(self,cr, uid, context=None): |
|||
|
|||
obj = self.pool.get('project.task') |
|||
obj1 = obj.search(cr, uid, []) |
|||
now = fields.Datetime.from_string(fields.Datetime.now()) |
|||
for obj2 in obj1: |
|||
|
|||
obj3 = obj.browse(cr, uid, obj2, context=context) |
|||
if obj3.stage_id.name != 'Done' and obj3.stage_id.name != 'Cancelled' and obj3.stage_id.name != 'Verified': |
|||
|
|||
end_date = fields.Datetime.from_string(obj3.date_deadline_ex) |
|||
|
|||
deadline_count = relativedelta(end_date, now) |
|||
if deadline_count.seconds < 0: |
|||
obj3.deadline_color = 'red' |
|||
else: |
|||
obj3.deadline_color = 'nothing' |
|||
|
|||
elif obj3.stage_id.name == 'Done' or obj3.stage_id.name == 'Verified': |
|||
|
|||
if obj3.progress1 < 100: |
|||
obj3.deadline_color = 'green' |
|||
else: |
|||
obj3.deadline_color = 'red' |
|||
|
|||
def process_demo_scheduler_queue(self, cr, uid, context=None): |
|||
obj = self.pool.get('project.task') |
|||
obj1 = obj.search(cr, uid, []) |
|||
now = fields.Datetime.from_string(fields.Datetime.now()) |
|||
for obj2 in obj1: |
|||
obj3 = obj.browse(cr, uid, obj2, context=context) |
|||
if obj3.stage_id.name != 'Done' and obj3.stage_id.name != 'Cancelled' and obj3.stage_id.name != 'Verified': |
|||
start_date = fields.Datetime.from_string(obj3.date_assign) |
|||
end_date = fields.Datetime.from_string(obj3.date_deadline_ex) |
|||
if obj3.date_deadline_ex and obj3.date_assign and end_date > start_date: |
|||
if now < end_date: |
|||
dif_tot = relativedelta(end_date, start_date) |
|||
dif_minut = dif_tot.hours * 60 + dif_tot.minutes |
|||
diff1 = end_date - start_date |
|||
total_minut = int(diff1.days) * 24 * 60 + dif_minut |
|||
dif2_tot = relativedelta(now, start_date) |
|||
dif2_minut = dif2_tot.hours * 60 + dif2_tot.minutes |
|||
diff2 = now - start_date |
|||
used_minut = int(diff2.days) * 24 * 60 + dif2_minut |
|||
if total_minut != 0: |
|||
obj3.progress1 = ((used_minut * 100) / total_minut) |
|||
else: |
|||
obj3.progress1 = 100 |
|||
else: |
|||
obj3.progress1 = 100 |
|||
else: |
|||
obj3.progress1 = 0 |
|
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 9.5 KiB |
@ -0,0 +1,51 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">Task Time Spend</h2> |
|||
<h3 class="oe_slogan">Calculates the time spend based on start date and deadline for every one hour</h3> |
|||
<h4 class="oe_slogan">Author : NILMAR SHEREEF , www.cybrosys.com</h4> |
|||
</div> |
|||
<div class="oe_row oe_spaced"> |
|||
<div> |
|||
This module helps to calculate the time spend for the specific task based on start date and deadline for every one hour until the stage becomes Done. And will shows |
|||
the progressbar in tree view and form view. |
|||
</div> |
|||
</div> |
|||
<div class="oe_row oe_spaced"> |
|||
<div> |
|||
☛ Installation : To install this module, you need also the project module. |
|||
</div> |
|||
</div> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span6"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img src="Screenshot from 2016-10-06 12:29:07.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span6"> |
|||
<p class='oe_mt32'> |
|||
Go to Project -> Task. And then create Task by specifying start date and deadline. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_padded"> |
|||
<div class="oe_span12"> |
|||
<p> |
|||
Go to Project -> Task . Here you can see progress bar based on start date and dead line in both list and form view. |
|||
</p> |
|||
</div> |
|||
<div class="oe_span6"> |
|||
<h3>Tree view</h3> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="Screenshot from 2016-10-06 12:30:12.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span6"> |
|||
<h3>Form view</h3> |
|||
<img class="oe_picture oe_screenshot" src="Screenshot from 2016-10-06 12:31:09.png"> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
@ -0,0 +1,129 @@ |
|||
<openerp> |
|||
<data> |
|||
<record id="ir_cron_scheduler_demo_action" model="ir.cron"> |
|||
<field name="name">Demo scheduler</field> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">minutes</field> |
|||
<field name="numbercall">-1</field> |
|||
<field eval="False" name="doall"/> |
|||
<field eval="'project.task'" name="model"/> |
|||
<field eval="'process_demo_scheduler_queue'" name="function"/> |
|||
</record> |
|||
|
|||
<record id="view_project_inherit" model="ir.ui.view"> |
|||
<field name="name">Project Inherit</field> |
|||
<field name="model">project.task</field> |
|||
<field name="inherit_id" ref="project.view_task_tree2"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='project_id']" position="after"> |
|||
<field name="progress1" widget="progressbar"/> |
|||
<field name="deadline_color" invisible="True"/> |
|||
</xpath> |
|||
<xpath expr="//tree[1]" position="attributes"> |
|||
<attribute name="colors">red:deadline_color=='red';green:deadline_color=='green'</attribute> |
|||
</xpath> |
|||
|
|||
<xpath expr="//field[@name='deadline_color']" position="attributes"> |
|||
<attribute name="attrs">{'invisible': [('deadline_color', '!=', 'XYZ')]}</attribute> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_project_inherit1" model="ir.ui.view"> |
|||
<field name="name">Project Inherit1</field> |
|||
<field name="model">project.task</field> |
|||
<field name="inherit_id" ref="project.view_task_form2"/> |
|||
<field name="arch" type="xml"> |
|||
<!-- <xpath expr="/form/notebook/page/field[@name='date_last_stage_update']" position="after"> |
|||
<field name="deadline_color"/> |
|||
</xpath>--> |
|||
<!--from --> |
|||
<xpath expr="//form" position="replace"> |
|||
<form string="Project"> |
|||
<header> |
|||
<field name="stage_id" widget="statusbar" clickable="True" |
|||
options="{'fold_field': 'fold'}"/> |
|||
</header> |
|||
<sheet string="Task"> |
|||
<div class="oe_button_box" name="button_box"> |
|||
<button name="toggle_active" type="object" groups="base.group_user" |
|||
class="oe_stat_button" icon="fa-archive"> |
|||
<field name="get_user" invisible="True"/> |
|||
<field name="active" widget="boolean_button" |
|||
options='{"terminology": "archive"}'/> |
|||
</button> |
|||
</div> |
|||
<field name="kanban_state" class="oe_inline" widget="kanban_state_selection" groups="project.group_project_manager"/> |
|||
<div class="oe_title"> |
|||
<h1 class="o_row"> |
|||
<field name="priority" widget="priority"/> |
|||
<field name="name" placeholder="Task Title..." attrs="{'readonly':[('get_user','!=',True)]}"/> |
|||
</h1> |
|||
</div> |
|||
<group> |
|||
<group> |
|||
<field name="project_id" domain="[('state','not in', ('close', 'cancelled'))]" |
|||
on_change="onchange_project(project_id)" |
|||
attrs="{'readonly':[('get_user','!=',True)]}" context="{'default_use_tasks':1}"/> |
|||
<field name="user_id" attrs="{'readonly':[('get_user','!=',True)]}" |
|||
options='{"no_open": True}' |
|||
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_user']}"/> |
|||
<field name="task_time" widget="float_time" attrs="{'readonly':[('get_user','!=',True)]}"/> |
|||
<field name="planned_hours" widget="float_time" |
|||
groups="project.group_time_work_estimation_tasks" |
|||
on_change="onchange_planned(planned_hours)"/> |
|||
<field name="legend_blocked" invisible="1"/> |
|||
<field name="legend_normal" invisible="1"/> |
|||
<field name="legend_done" invisible="1"/> |
|||
</group> |
|||
<group> |
|||
<field name="date_deadline_ex" attrs="{'readonly':[('get_user','!=',True)]}"/> |
|||
<field name="tag_ids" widget="many2many_tags" attrs="{'readonly':[('get_user','!=',True)]}"/> |
|||
<field name="progress1" widget="progressbar"/> |
|||
</group> |
|||
</group> |
|||
<notebook> |
|||
<page name="description_page" string="Description"> |
|||
<field name="description" type="html"/> |
|||
<div class="oe_clear"/> |
|||
</page> |
|||
<page string="Extra Info"> |
|||
<group col="4"> |
|||
<group col="2"> |
|||
<field name="sequence" groups="base.group_no_one"/> |
|||
<field name="partner_id"/> |
|||
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> |
|||
<field name="displayed_image_id" groups="base.group_no_one"/> |
|||
</group> |
|||
<group col="2"> |
|||
<field name="date_assign" groups="base.group_no_one"/> |
|||
<field name="date_last_stage_update" groups="base.group_no_one"/> |
|||
</group> |
|||
</group> |
|||
</page> |
|||
</notebook> |
|||
</sheet> |
|||
<div class="oe_chatter"> |
|||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/> |
|||
<field name="message_ids" widget="mail_thread"/> |
|||
</div> |
|||
</form> |
|||
</xpath> |
|||
|
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_project_inherit2" model="ir.ui.view"> |
|||
<field name="name">Project Inherit2</field> |
|||
<field name="model">project.task</field> |
|||
<field name="inherit_id" ref="project.view_task_kanban"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//t[@t-name='kanban-box']" position="attributes"> |
|||
<attribute name="attrs">{'invisible':[('kanban_state','=','blocked')]}</attribute> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Loading…
Reference in new issue