diff --git a/project_time_spend/__init__.py b/project_time_spend/__init__.py new file mode 100644 index 000000000..bff786c08 --- /dev/null +++ b/project_time_spend/__init__.py @@ -0,0 +1 @@ +import models diff --git a/project_time_spend/__openerp__.py b/project_time_spend/__openerp__.py new file mode 100644 index 000000000..9844c409f --- /dev/null +++ b/project_time_spend/__openerp__.py @@ -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, +} diff --git a/project_time_spend/__openerp__.py~ b/project_time_spend/__openerp__.py~ new file mode 100644 index 000000000..961c88d00 --- /dev/null +++ b/project_time_spend/__openerp__.py~ @@ -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, +} diff --git a/project_time_spend/models/__init__.py b/project_time_spend/models/__init__.py new file mode 100644 index 000000000..83fddeff1 --- /dev/null +++ b/project_time_spend/models/__init__.py @@ -0,0 +1 @@ +import project_statusbar diff --git a/project_time_spend/models/project_statusbar.py b/project_time_spend/models/project_statusbar.py new file mode 100644 index 000000000..c5447d67e --- /dev/null +++ b/project_time_spend/models/project_statusbar.py @@ -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 diff --git a/project_time_spend/security/ir.model.access.csv b/project_time_spend/security/ir.model.access.csv new file mode 100644 index 000000000..0bb85e38c --- /dev/null +++ b/project_time_spend/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +project.access_project_task,project.task,project.model_project_task,project.group_project_user,1,1,0,0 diff --git a/project_time_spend/static/description/Screenshot from 2016-10-06 12:29:07.png b/project_time_spend/static/description/Screenshot from 2016-10-06 12:29:07.png new file mode 100644 index 000000000..37bd23986 Binary files /dev/null and b/project_time_spend/static/description/Screenshot from 2016-10-06 12:29:07.png differ diff --git a/project_time_spend/static/description/Screenshot from 2016-10-06 12:30:12.png b/project_time_spend/static/description/Screenshot from 2016-10-06 12:30:12.png new file mode 100644 index 000000000..86fac1971 Binary files /dev/null and b/project_time_spend/static/description/Screenshot from 2016-10-06 12:30:12.png differ diff --git a/project_time_spend/static/description/Screenshot from 2016-10-06 12:31:09.png b/project_time_spend/static/description/Screenshot from 2016-10-06 12:31:09.png new file mode 100644 index 000000000..ba41a7be5 Binary files /dev/null and b/project_time_spend/static/description/Screenshot from 2016-10-06 12:31:09.png differ diff --git a/project_time_spend/static/description/icon.png b/project_time_spend/static/description/icon.png new file mode 100644 index 000000000..a0fb5a2ee Binary files /dev/null and b/project_time_spend/static/description/icon.png differ diff --git a/project_time_spend/static/description/index.html b/project_time_spend/static/description/index.html new file mode 100644 index 000000000..1d9b26812 --- /dev/null +++ b/project_time_spend/static/description/index.html @@ -0,0 +1,51 @@ +
+
+

Task Time Spend

+

Calculates the time spend based on start date and deadline for every one hour

+

Author : NILMAR SHEREEF , www.cybrosys.com

+
+
+
+ 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. +
+
+
+
+ ☛ Installation : To install this module, you need also the project module. +
+
+
+
+
+ +
+
+
+

+ Go to Project -> Task. And then create Task by specifying start date and deadline. +

+
+
+
+ +
+
+
+

+ Go to Project -> Task . Here you can see progress bar based on start date and dead line in both list and form view. +

+
+
+

Tree view

+
+ +
+
+
+

Form view

+ +
+
+
+ diff --git a/project_time_spend/views/project_statusbar_view.xml b/project_time_spend/views/project_statusbar_view.xml new file mode 100644 index 000000000..852a115d4 --- /dev/null +++ b/project_time_spend/views/project_statusbar_view.xml @@ -0,0 +1,59 @@ + + + + Demo scheduler + + 1 + minutes + -1 + + + + + + + Project Inherit + project.task + + + + + + + + + + red:deadline_color=='red';green:deadline_color=='green' + + + {'invisible': [('deadline_color', '!=', 'XYZ')]} + + + + + + Project Inherit1 + project.task + + + + + + + + + + + + + Project Inherit2 + project.task + + + + {'invisible':[('kanban_state','=','blocked')]} + + + + + \ No newline at end of file diff --git a/sale_discount_total/static/description/icon.png b/sale_discount_total/static/description/icon.png index 85991e4c6..6a1daaf65 100644 Binary files a/sale_discount_total/static/description/icon.png and b/sale_discount_total/static/description/icon.png differ