Skip to content

Commit 94364b0

Browse files
[MIG] hr_holidays_auto_extend: Migration to 18.0
1 parent e5f92d3 commit 94364b0

9 files changed

Lines changed: 25 additions & 17 deletions

File tree

hr_holidays_auto_extend/README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ Contributors
7171
------------
7272

7373
- Enric Tobella
74-
-
74+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__
75+
76+
- Bhavesh Heliconia
7577

7678
Maintainers
7779
-----------

hr_holidays_auto_extend/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Hr Holidays Auto Extend",
66
"summary": """
77
Allow to extend some kind of holidays""",
8-
"version": "16.0.1.0.0",
8+
"version": "18.0.1.0.0",
99
"license": "AGPL-3",
1010
"author": "CreuBlanca,Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/hr-holidays",

hr_holidays_auto_extend/data/cron.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<field name="user_id" ref="base.user_root" />
66
<field name="interval_number">1</field>
77
<field name="interval_type">days</field>
8-
<field name="numbercall">-1</field>
98
<field name="model_id" ref="model_hr_leave" />
109
<field name="state">code</field>
1110
<field name="code">model._cron_auto_extend()</field>

hr_holidays_auto_extend/models/hr_leave.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ def _cron_auto_extend(self):
6969
)
7070
continue
7171
vals = {"request_date_to": request_date_to}
72-
vals.update(
73-
leave.onchange(vals, ["request_date_to"], leave._onchange_spec())[
74-
"value"
75-
]
76-
)
72+
fields_spec = {}
73+
result = leave.onchange(vals, ["request_date_to"], fields_spec)
74+
75+
if result and "value" in result:
76+
vals.update(result["value"])
77+
7778
leave.write(vals)
7879
leave._remove_resource_leave()
7980
leave._create_resource_leave()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
- Enric Tobella
2-
-
2+
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
3+
- Bhavesh Heliconia
4+

hr_holidays_auto_extend/static/description/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
418418
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
419419
<ul class="simple">
420420
<li>Enric Tobella</li>
421-
<li></li>
421+
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
422+
<li>Bhavesh Heliconia</li>
423+
</ul>
424+
</li>
422425
</ul>
423426
</div>
424427
<div class="section" id="maintainers">

hr_holidays_auto_extend/tests/test_extend.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from datetime import timedelta
55

66
from odoo import fields
7-
from odoo.tests.common import Form
7+
from odoo.tests import Form
88

99
from odoo.addons.hr_holidays.tests.common import TestHrHolidaysCommon
1010

@@ -15,6 +15,7 @@ def test_time_type(self):
1515
{
1616
"name": "Paid Time Off",
1717
"time_type": "leave",
18+
"requires_allocation": "no",
1819
"auto_extend": True,
1920
}
2021
)
@@ -50,12 +51,14 @@ def test_extend_overlap(self):
5051
{
5152
"name": "Paid Time Off",
5253
"time_type": "leave",
54+
"requires_allocation": "no",
5355
"auto_extend": True,
5456
}
5557
)
5658
leave_type_02 = self.env["hr.leave.type"].create(
5759
{
5860
"name": "Another leave type",
61+
"requires_allocation": "no",
5962
"time_type": "leave",
6063
}
6164
)
@@ -102,6 +105,7 @@ def test_check_date_state(self):
102105
{
103106
"name": "Paid Time Off",
104107
"time_type": "leave",
108+
"requires_allocation": "no",
105109
"auto_extend": True,
106110
}
107111
)

hr_holidays_auto_extend/views/hr_leave.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
name="auto_extend"
1414
groups="hr_holidays.group_hr_holidays_user"
1515
widget="boolean_toggle"
16-
attrs="{'invisible':[('auto_extend_type', '=', False), ('auto_extend', '=', False)]}"
16+
invisible="not auto_extend_type and not auto_extend"
1717
/>
1818
<field
1919
name="auto_extend_period"
2020
groups="hr_holidays.group_hr_holidays_user"
21-
attrs="{'invisible':[('auto_extend', '=', False)]}"
21+
invisible="not auto_extend"
2222
/>
2323
</field>
2424
</field>

hr_holidays_auto_extend/views/hr_leave_type.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
<field name="arch" type="xml">
1010
<field name="request_unit" position="after">
1111
<field name="auto_extend" widget="boolean_toggle" />
12-
<field
13-
name="auto_extend_period"
14-
attrs="{'invisible':[('auto_extend', '=', False)]}"
15-
/>
12+
<field name="auto_extend_period" invisible="not auto_extend" />
1613
</field>
1714
</field>
1815
</record>

0 commit comments

Comments
 (0)