diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py
index 458a670..b22397e 100755
--- a/cor_custom/models/analytic.py
+++ b/cor_custom/models/analytic.py
@@ -14,33 +14,43 @@ import dateutil.parser
class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'
+ def _domain_project_id(self):
+ domain = [('allow_timesheets', '=', True),('is_sub_project', '=', False)]
+ if not self.user_has_groups('hr_timesheet.group_timesheet_manager'):
+ return expression.AND([domain,
+ ['|', ('privacy_visibility', '!=', 'followers'), ('allowed_internal_user_ids', 'in', self.env.user.ids)]
+ ])
+ return domain
+
+ project_id = fields.Many2one(
+ 'project.project', 'Project', compute='_compute_project_id', store=True, readonly=False,
+ domain=_domain_project_id)
start_time = fields.Float(string='Start Time', digits=(16, 2))
end_time = fields.Float(string='End Time', digits=(16, 2))
+ start_datetime = fields.Datetime("Start Time", required=True)
+ end_datetime = fields.Datetime("End Time", required=True)
unit_amount = fields.Float('Duration', default=0.0)
parent_project = fields.Many2one('project.project', related='project_id.parent_project', string='Parent Project')
+ sub_project = fields.Many2one('project.project', domain="[('is_sub_project', '=', True)]",
+ string='Sub Project')
+ @api.onchange('project_id')
+ def _onchange_sub_project_id(self):
+ self.sub_project = False
+ res = {}
+ if self.project_id and self.project_id.sub_project:
+ res['domain'] = {'sub_project': [('id', 'in', self.project_id.sub_project.ids)]}
+ else:
+ res['domain'] = {'sub_project': [('id', '=', False)]}
+ return res
+
def _default_start_datetime(self):
return fields.Datetime.to_string(datetime.combine(fields.Datetime.now(), datetime.min.time()))
def _default_end_datetime(self):
return fields.Datetime.to_string(datetime.combine(fields.Datetime.now(), datetime.max.time()))
- start_datetime = fields.Datetime("Start Time", required=True)
- end_datetime = fields.Datetime("End Time", required=True)
-
-
- # @api.onchange('project_id')
- # def _onchange_parent_project_id(self):
- # if self.project_id:
- # parent_project = self.env['project.project'].search([('sub_project', '=', self.project_id.id)], limit=1)
- # if parent_project:
- # self.parent_project = parent_project.id
- # else:
- # self.parent_project = False
- # else:
- # self.parent_project = False
-
@api.onchange('employee_id')
def _onchange_employee_id(self):
@@ -90,7 +100,7 @@ class AccountAnalyticLine(models.Model):
self.task_id = False
return result
- _sql_constraints = [
+ """_sql_constraints = [
('check_start_time_lower_than_24', 'CHECK(start_time <= 24)', 'You cannot have a start hour greater than 24'),
('check_start_time_positive', 'CHECK(start_time >= 0)', 'Start hour must be a positive number'),
('check_end_time_lower_than_24', 'CHECK(end_time <= 24)', 'You cannot have a end hour greater than 24'),
@@ -110,7 +120,7 @@ class AccountAnalyticLine(models.Model):
res = self.end_time - self.start_time
if res <= 0:
raise ValidationError(_("End time cannot be earlier than Start time"))
- self.unit_amount = res
+ self.unit_amount = res"""
@api.onchange('start_datetime', 'end_datetime')
def _onchange_start_end_date_time(self):
@@ -155,7 +165,7 @@ class AccountAnalyticLine(models.Model):
ttask = res['datas'][index][taskindex]
if type(ttask) == bool:
res['datas'][index][taskindex] = ''
- if fields_name.get('start_time') is not None:
+ """if fields_name.get('start_time') is not None:
starttimeindex = fields_name.get('start_time')
starttime = float(res['datas'][index][starttimeindex])
if starttime:
@@ -166,13 +176,15 @@ class AccountAnalyticLine(models.Model):
endtime = float(res['datas'][index][endtimeindex])
if endtime:
end_time = tools.format_duration(endtime)
- res['datas'][index][endtimeindex] = end_time
+ res['datas'][index][endtimeindex] = end_time"""
if fields_name.get('unit_amount') is not None:
durationindex = fields_name.get('unit_amount')
duration = res['datas'][index][durationindex] and float(res['datas'][index][durationindex])
if duration:
- duration_time = tools.format_duration(duration)
+ duration_time = round(duration, 2)
res['datas'][index][durationindex] = duration_time
+ #duration_time = tools.format_duration(duration)
+ #res['datas'][index][durationindex] = duration_time
return res
@api.model
diff --git a/cor_custom/models/project_hours.py b/cor_custom/models/project_hours.py
index 62ea634..9464a02 100755
--- a/cor_custom/models/project_hours.py
+++ b/cor_custom/models/project_hours.py
@@ -77,7 +77,7 @@ class ProjectConsultantHrs(models.Model):
val.budgeted_hours = 0
@api.depends('project_id', 'start_date', 'end_date', 'project_id.timesheet_ids', 'project_id.timesheet_ids.date', 'project_id.timesheet_ids.project_id',
- 'project_id.timesheet_ids.employee_id', 'project_id.timesheet_ids.start_time', 'project_id.timesheet_ids.end_time', 'project_id.timesheet_ids.unit_amount')
+ 'project_id.timesheet_ids.employee_id', 'project_id.timesheet_ids.start_datetime', 'project_id.timesheet_ids.end_datetime', 'project_id.timesheet_ids.unit_amount')
def _compute_actual_calc(self):
Timesheet = self.env['account.analytic.line']
for val in self:
diff --git a/cor_custom/views/analytic_view.xml b/cor_custom/views/analytic_view.xml
index 8493301..f65884a 100755
--- a/cor_custom/views/analytic_view.xml
+++ b/cor_custom/views/analytic_view.xml
@@ -21,8 +21,6 @@
-
-
@@ -69,17 +67,16 @@
+
-
-
-
+
@@ -163,6 +160,7 @@
+
@@ -171,8 +169,6 @@
-
-
@@ -184,6 +180,42 @@
+
+ account.analytic.line.search
+ account.analytic.line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+>>>>>>> 0964d5378c9e26188e9e977126bb2beb977992ea
account.analytic.line.calendar
account.analytic.line
diff --git a/field_hide/.idea/custom_project.iml b/field_hide/.idea/custom_project.iml
new file mode 100755
index 0000000..6711606
--- /dev/null
+++ b/field_hide/.idea/custom_project.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/field_hide/.idea/misc.xml b/field_hide/.idea/misc.xml
new file mode 100755
index 0000000..6c993b7
--- /dev/null
+++ b/field_hide/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/field_hide/.idea/modules.xml b/field_hide/.idea/modules.xml
new file mode 100755
index 0000000..272f62f
--- /dev/null
+++ b/field_hide/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/field_hide/.idea/vcs.xml b/field_hide/.idea/vcs.xml
new file mode 100755
index 0000000..6c0b863
--- /dev/null
+++ b/field_hide/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/field_hide/.idea/workspace.xml b/field_hide/.idea/workspace.xml
new file mode 100755
index 0000000..7a2a3b6
--- /dev/null
+++ b/field_hide/.idea/workspace.xml
@@ -0,0 +1,327 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fix
+ def create
+ test_field
+ _issue_open_count
+ issue_open_count
+ reopem
+ za
+ bug_find_time
+ tot
+ chatt
+ fixt
+ total_time
+ get_total_fixture_time
+ fixture_time
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1554196611759
+
+
+ 1554196611759
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/field_hide/__init__.py b/field_hide/__init__.py
new file mode 100755
index 0000000..5305644
--- /dev/null
+++ b/field_hide/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import models
\ No newline at end of file
diff --git a/field_hide/__manifest__.py b/field_hide/__manifest__.py
new file mode 100755
index 0000000..4fd8372
--- /dev/null
+++ b/field_hide/__manifest__.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': "SunArc Field Hide",
+ 'author': "SunArc Technologies",
+ 'website': "http://www.sunarctechnologies.com",
+ 'sequence': 3,
+ 'category': 'Other',
+ 'version': '14.0.1.1',
+ 'depends': ['base','crm', 'project'],
+ 'data': ['views/field_remove_template.xml',],
+ 'application': False
+}
diff --git a/field_hide/models/__init__.py b/field_hide/models/__init__.py
new file mode 100755
index 0000000..a8de247
--- /dev/null
+++ b/field_hide/models/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+from . import field_hide
+
diff --git a/field_hide/models/field_hide.py b/field_hide/models/field_hide.py
new file mode 100755
index 0000000..188a78f
--- /dev/null
+++ b/field_hide/models/field_hide.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from odoo import api, fields, models, tools, SUPERUSER_ID, _
+
+class ProjectFields(models.Model):
+ _inherit = "project.project"
+
+ @api.model
+ def get_fields_to_ignore_in_export_in_project(self):
+ # this function is mainly used for to hide filter from group by
+ return ['resource_calendar_id', 'website_message_ids', 'warning_employee_rate', 'privacy_visibility']
+
+ @api.model
+ def fields_get(self, allfields=None, attributes=None):
+ # This function mainly use for hide below field from export
+ res = super(ProjectFields, self).fields_get(allfields)
+ for field in self.get_fields_to_ignore_in_export_in_project():
+ if res.get(field):
+ res.get(field)['exportable'] = False
+ return res
+
+
+
+
+
+
diff --git a/field_hide/static/src/js/field_remove.js b/field_hide/static/src/js/field_remove.js
new file mode 100755
index 0000000..fd23b60
--- /dev/null
+++ b/field_hide/static/src/js/field_remove.js
@@ -0,0 +1,20 @@
+odoo.define('module.ControlPanel', function (require) {
+ 'use strict';
+ var ControlPanel = require('web.ControlPanel');
+ /* Below function is mainly used for hide field from project export section*/
+ ControlPanel.include({
+ _update_search_view: function(searchview, is_hidden) {
+ this._super.apply(this, arguments);
+ if(searchview){
+ this._rpc({
+ model: 'project.project',
+ method: 'get_fields_to_ignore_in_export_in_project',
+ }).then(function (result) {
+ for(var i=0;i
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project_report/report/project_timesheet_report.py b/project_report/report/project_timesheet_report.py
index bfe6d40..f21d4b4 100755
--- a/project_report/report/project_timesheet_report.py
+++ b/project_report/report/project_timesheet_report.py
@@ -57,8 +57,10 @@ class ProjectTimelineReport(models.Model):
durationindex = fields_name.get('duration')
duration = res['datas'][index][durationindex] and float(res['datas'][index][durationindex])
if duration:
- duration_time = tools.format_duration(duration)
+ duration_time = round(duration, 2)
res['datas'][index][durationindex] = duration_time
+ #duration_time = tools.format_duration(duration)
+ #res['datas'][index][durationindex] = duration_time
return res
def init(self):
diff --git a/project_report/report/project_timesheet_report_views.xml b/project_report/report/project_timesheet_report_views.xml
index 167c026..d3da360 100755
--- a/project_report/report/project_timesheet_report_views.xml
+++ b/project_report/report/project_timesheet_report_views.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/sub_project/__manifest__.py b/sub_project/__manifest__.py
index ae3332f..bb4bcb7 100755
--- a/sub_project/__manifest__.py
+++ b/sub_project/__manifest__.py
@@ -9,9 +9,10 @@
'license': '',
'depends': ['base', 'project'],
'data': ['views/sub_project.xml',
+ #'views/analytic_view.xml',
'security/ir.model.access.csv'],
'demo': [''],
'installable': True,
'auto_install': False,
-}
\ No newline at end of file
+}
diff --git a/sub_project/models/__init__.py b/sub_project/models/__init__.py
index d30a3e9..d5082c4 100755
--- a/sub_project/models/__init__.py
+++ b/sub_project/models/__init__.py
@@ -1 +1,2 @@
-from . import sub_project
\ No newline at end of file
+from . import sub_project
+from . import analytic
\ No newline at end of file
diff --git a/sub_project/models/analytic.py b/sub_project/models/analytic.py
new file mode 100755
index 0000000..7a1efcc
--- /dev/null
+++ b/sub_project/models/analytic.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details
+
+from odoo import api, exceptions, fields, models, tools, _
+from odoo.exceptions import UserError, AccessError, ValidationError
+from odoo.osv import expression
+import math
+from datetime import datetime, time, timedelta
+from odoo.tools.float_utils import float_round
+from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, ustr
+import dateutil.parser
+
+
+class AccountAnalyticLineSubProject(models.Model):
+ _inherit = 'account.analytic.line'
+
+ # sub_project = fields.Many2many('project.project', 'project_subproject_timesheet_rel', 'project_id', 'id',
+ # domain="[('is_sub_project', '=', True),('parent_project', '=', False)]",
+ # string='Sub Project')
+
+
+
+ # @api.onchange('project_id')
+ # def _onchange_parent_project_id(self):
+ # if self.project_id:
+ # parent_project = self.env['project.project'].search([('sub_project', '=', self.project_id.id)], limit=1)
+ # if parent_project:
+ # self.parent_project = parent_project.id
+ # else:
+ # self.parent_project = False
+ # else:
+ # self.parent_project = False
\ No newline at end of file
diff --git a/sub_project/views/analytic_view.xml b/sub_project/views/analytic_view.xml
new file mode 100755
index 0000000..aa4612e
--- /dev/null
+++ b/sub_project/views/analytic_view.xml
@@ -0,0 +1,13 @@
+
+
+
+