Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Aug 18, 2024
1 parent f799d3f commit 8a521c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 7 additions & 9 deletions hr_timesheet_quick_add/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Hr_TimesheetSheet(models.Model):
store=False,
compute="_compute_recent_tasks",
)
default_hour = fields.Integer(default=1)
default_name = fields.Char(default="/")

@api.depends("timesheet_ids")
def _compute_recent_tasks(self):
Expand Down Expand Up @@ -50,18 +52,14 @@ def _add_timesheet_from_candidates(self, residual_tasks):
{
"project_id": task.project_id.id,
"task_id": task.id,
"unit_amount": self._get_default_unit_amout_from_candidates(),
"name": self._get_default_name_from_candidates(),
"date": fields.Date.today(),
"unit_amount": self.default_hour,
"name": self.default_name,
}
)
date = fields.Date.today()
if date >= self.date_start and date <= self.date_end:
vals["date"] = date
self.timesheet_ids |= self.env["account.analytic.line"]._sheet_create(vals)

def _get_default_name_from_candidates(self):
return "/"

def _get_default_unit_amout_from_candidates(self):
return 1

def _get_default_days_history(self):
return 20
4 changes: 4 additions & 0 deletions hr_timesheet_quick_add/views/hr_timesheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
colspan="4"
>If you remove candidates and save, they'll be populated as real timesheets</div>
</group>
<group col="4">
<field name="default_hour" />
<field name="default_name" />
</group>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 8a521c7

Please sign in to comment.