Start and end time removed

This commit is contained in:
projectsodoo 2021-03-08 19:23:38 +05:30
parent f5827617f6
commit a4813e9e31
3 changed files with 22 additions and 7 deletions

View File

@ -14,8 +14,8 @@ import dateutil.parser
class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'
start_time = fields.Float(string='Start Time', digits=(16, 2))
end_time = fields.Float(string='End Time', digits=(16, 2))
#start_time = fields.Float(string='Start Time', digits=(16, 2))
#end_time = fields.Float(string='End Time', digits=(16, 2))
unit_amount = fields.Float('Duration', default=0.0)
parent_project = fields.Many2one('project.project', related='project_id.parent_project', string='Parent Project')
@ -90,7 +90,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 +110,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 +155,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,7 +166,7 @@ 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])

View File

@ -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:

View File

@ -184,6 +184,21 @@
</field>
</record>
<record id="timesheet_view_inherit1_search" model="ir.ui.view">
<field name="name">account.analytic.line.search</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="replace">
<field name="start_datetime"/>
</xpath>
<xpath expr="//filter[@name='groupby_date']" position="replace">
<filter string="Start Time" name="groupby_startdate" domain="[]" context="{'group_by': 'start_datetime'}" help="Timesheet by Start Date"/>
</xpath>
</field>
</record>
<record id="view_hr_my_timesheet_line_calendar" model="ir.ui.view">
<field name="name">account.analytic.line.calendar</field>
<field name="model">account.analytic.line</field>