-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] allow adding calendar links to time off calendar, default icals
- Loading branch information
Showing
7 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="ical_my_leaves" model="base.ical"> | ||
<field name="name">My leaves</field> | ||
<field name="model_id" ref="hr_holidays.model_hr_leave" /> | ||
<field name="domain">[('user_id', '=', user.id)]</field> | ||
<field name="expression_uid">str(record.id)</field> | ||
<field name="expression_dtstart"> | ||
(record.request_unit_half or record.request_unit_hours) and record.date_from | ||
or record.date_from.date() | ||
</field> | ||
<field name="expression_dtend"> | ||
(record.request_unit_half or record.request_unit_hours) and record.date_to | ||
or (record.date_to.date() + timedelta(days=1)) | ||
</field> | ||
<field name="expression_summary">record.name</field> | ||
<field name="auto" eval="True" /> | ||
<field name="show_on_holiday_calendar" eval="True" /> | ||
</record> | ||
<record id="ical_my_team_leaves" model="base.ical"> | ||
<field name="name">My team leaves</field> | ||
<field name="model_id" ref="hr_holidays.model_hr_leave" /> | ||
<field name="domain"> | ||
[('user_id.employee_id.department_id', '=', | ||
user.employee_id.department_id.id), ('user_id', '!=', user.id)] | ||
</field> | ||
<field name="expression_uid">str(record.id)</field> | ||
<field name="expression_dtstart"> | ||
(record.request_unit_half or record.request_unit_hours) and record.date_from | ||
or record.date_from.date() | ||
</field> | ||
<field name="expression_dtend"> | ||
(record.request_unit_half or record.request_unit_hours) and record.date_to | ||
or (record.date_to.date() + timedelta(days=1)) | ||
</field> | ||
<field name="expression_summary">record.name</field> | ||
<field name="auto" eval="True" /> | ||
<field name="show_on_holiday_calendar" eval="True" /> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import base_ical | ||
from . import hr_attendance | ||
from . import hr_leave_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2023 Hunki Enterprises BV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class BaseIcal(models.Model): | ||
_inherit = "base.ical" | ||
|
||
show_on_holiday_calendar = fields.Boolean("Show on holiday calendar") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
odoo.define("verdigado_attendance.time_off_calendar", function (require) { | ||
"use strict"; | ||
|
||
var viewRegistry = require("web.view_registry"); | ||
// Even though core doesn't return anything here, we need the require for correct dependencies | ||
require("hr_holidays.dashboard.view_custo"); | ||
|
||
viewRegistry.get("time_off_calendar_all").prototype.config.Renderer.include({ | ||
_render: function () { | ||
var self = this; | ||
return this._super.apply(this, arguments).then(function () { | ||
return self | ||
._rpc({ | ||
model: "base.ical", | ||
method: "search_read", | ||
args: [ | ||
[["show_on_holiday_calendar", "=", true]], | ||
["user_active", "user_url", "name"], | ||
], | ||
context: self.state.context, | ||
}) | ||
.then(function (ical_calendars) { | ||
var $links = self.$(".ical_links"); | ||
if (ical_calendars.length === 0) { | ||
$links.hide(); | ||
} else { | ||
_.chain(ical_calendars) | ||
.filter("user_active") | ||
.each(function (ical) { | ||
var $a = jQuery( | ||
'<a href="' + ical.user_url + '"/>' | ||
); | ||
$a.text(ical.name); | ||
$links.append($a); | ||
$links.append("<br/>"); | ||
}); | ||
} | ||
}); | ||
}); | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<templates> | ||
<t t-extend="TimeOff.CalendarView.extend"> | ||
<t t-jquery="div.o_timeoff_legend" t-operation="after"> | ||
<div class="ical_links"> | ||
<h5>Calendar links</h5> | ||
<ul /> | ||
</div> | ||
</t> | ||
</t> | ||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2023 Hunki Enterprises BV | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) --> | ||
<data> | ||
<record id="view_base_ical_form" model="ir.ui.view"> | ||
<field name="model">base.ical</field> | ||
<field name="inherit_id" ref="base_ical.view_base_ical_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="auto" position="after"> | ||
<field name="show_on_holiday_calendar" /> | ||
</field> | ||
</field> | ||
</record> | ||
</data> |