13 changed files with 242 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 assign 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': '8.0.0.3', |
||||
|
'summary': 'Calculates the time spend based on assign 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,94 @@ |
|||||
|
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) |
||||
|
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_start) |
||||
|
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,59 @@ |
|||||
|
<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='progress']" position="replace"> |
||||
|
<field name="progress1" widget="progressbar"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='project_id']" position="after"> |
||||
|
<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="//field[@name='date_deadline']" position="replace"> |
||||
|
<field name="date_deadline_ex" attrs="{'readonly':[('get_user','!=',True)]}"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='progress']" position="after"> |
||||
|
<field name="get_user" invisible="True"/> |
||||
|
<field name="progress1" widget="progressbar"/> |
||||
|
</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> |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 9.9 KiB |
Loading…
Reference in new issue