resolved installation issue of grace period module

This commit is contained in:
Bhagya-K 2026-06-10 11:59:42 +05:30
parent adfe801d8e
commit 68e62956b7
3 changed files with 12 additions and 23 deletions

View File

@ -1,5 +1,5 @@
from . import resource_calendar_period from . import resource_calendar_period
from . import late_coming_request from . import late_coming_request
from . import ot_request
from . import attendance_data from . import attendance_data
from . import hr_employee_inherit from . import hr_employee_inherit
from . import ot_request

View File

@ -96,7 +96,6 @@ class WeeklyPeriodTimesheets(models.Model):
for rec in self: for rec in self:
if rec.state != 'submitted': if rec.state != 'submitted':
raise UserError( raise UserError(
_("Only submitted timesheets can be approved.") _("Only submitted timesheets can be approved.")
) )
@ -110,10 +109,9 @@ class WeeklyPeriodTimesheets(models.Model):
) )
# Validation # Validation
if ( if (
self.env.user != employee_manager self.env.user != employee_manager
and not is_admin and not is_admin
): ):
raise UserError( raise UserError(
_("Only Employee Manager or Project Administrator can approve.") _("Only Employee Manager or Project Administrator can approve.")
) )
@ -130,7 +128,6 @@ class WeeklyPeriodTimesheets(models.Model):
]) ])
if pending_lines: if pending_lines:
raise UserError( raise UserError(
_("All Project Manager approvals must be completed.") _("All Project Manager approvals must be completed.")
) )
@ -226,19 +223,19 @@ class WeeklyPeriodTimesheets(models.Model):
analytic_line_ids = fields.One2many( analytic_line_ids = fields.One2many(
'account.analytic.line', 'account.analytic.line',
compute='_compute_analytic_lines', compute='_compute_analytic_lines',
inverse='_inverse_analytic_lines',
string="Original Timesheets" string="Original Timesheets"
) )
def _inverse_analytic_lines(self):
pass
@api.depends('employee_id', 'week_line_id') @api.depends('employee_id', 'week_line_id')
def _compute_analytic_lines(self): def _compute_analytic_lines(self):
for rec in self: for rec in self:
rec.analytic_line_ids = False rec.analytic_line_ids = False
if not rec.employee_id or not rec.week_line_id: if not rec.employee_id or not rec.week_line_id:
continue continue
analytic_lines = self.env[ analytic_lines = self.env[
'account.analytic.line' 'account.analytic.line'
].search([ ].search([
@ -246,13 +243,10 @@ class WeeklyPeriodTimesheets(models.Model):
('date', '>=', rec.week_line_id.date_from), ('date', '>=', rec.week_line_id.date_from),
('date', '<=', rec.week_line_id.date_to), ('date', '<=', rec.week_line_id.date_to),
]) ])
rec.analytic_line_ids = analytic_lines rec.analytic_line_ids = analytic_lines
all_pm_approved = fields.Boolean( all_pm_approved = fields.Boolean(
compute='_compute_all_pm_approved' compute='_compute_all_pm_approved'
) )
def _compute_all_pm_approved(self): def _compute_all_pm_approved(self):
for rec in self: for rec in self:
@ -315,10 +309,9 @@ class AccountAnalyticLine(models.Model):
def _compute_pm_approval_required(self): def _compute_pm_approval_required(self):
for rec in self: for rec in self:
rec.pm_approval_required = not ( rec.pm_approval_required = not (
rec.task_id.is_generic rec.task_id.is_generic
or rec.project_id.privacy_visibility != 'followers' or rec.project_id.privacy_visibility != 'followers'
) )
def action_pm_approve(self): def action_pm_approve(self):
@ -416,7 +409,6 @@ class AccountAnalyticLine(models.Model):
], limit=1) ], limit=1)
if weekly_sheet: if weekly_sheet:
raise ValidationError( raise ValidationError(
"Weekly Timesheet already submitted. " "Weekly Timesheet already submitted. "
"You cannot create, edit or delete " "You cannot create, edit or delete "

View File

@ -65,11 +65,8 @@
</field> </field>
</page> </page>
<page string="Daily Timesheets"> <page string="Daily Timesheets">
<field name="analytic_line_ids" <field name="analytic_line_ids">
readonly="1"> <list editable="bottom">
<list create="0"
edit="0"
delete="0">
<field name="date"/> <field name="date"/>
<field name="employee_id"/> <field name="employee_id"/>
<field name="name"/> <field name="name"/>