Skip to content

Commit 302bb1e

Browse files
astirpefeketemihai
authored andcommitted
[12.0][MIG] date_range
1 parent 4250fc7 commit 302bb1e

19 files changed

+155
-188
lines changed

date_range/README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Date Range
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github
17-
:target: https://github.com/OCA/server-ux/tree/11.0/date_range
17+
:target: https://github.com/OCA/server-ux/tree/12.0/date_range
1818
:alt: OCA/server-ux
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
2020
:target: https://translation.odoo-community.org/projects/server-ux-11-0/server-ux-11-0-date_range
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/250/11.0
23+
:target: https://runbot.odoo-community.org/runbot/250/12.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -97,7 +97,7 @@ Bug Tracker
9797
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/issues>`_.
9898
In case of trouble, please check there if your issue has already been reported.
9999
If you spotted it first, help us smashing it by providing a detailed and welcomed
100-
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20date_range%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
100+
`feedback <https://github.com/OCA/server-ux/issues/new?body=module:%20date_range%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
101101

102102
Do not contact contributors directly about support or help with technical issues.
103103

@@ -133,10 +133,10 @@ promote its widespread use.
133133
:target: https://github.com/lmignon
134134
:alt: lmignon
135135

136-
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
136+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`_:
137137

138138
|maintainer-lmignon|
139139

140-
This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/11.0/date_range>`_ project on GitHub.
140+
This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/12.0/date_range>`_ project on GitHub.
141141

142142
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

date_range/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
21
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
32

43
from . import models

date_range/__manifest__.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
1+
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33
{
44
"name": "Date Range",
55
"summary": "Manage all kind of date range",
6-
"version": "11.0.2.0.0",
6+
"version": "12.0.1.0.0",
77
"category": "Uncategorized",
88
"website": "https://github.com/oca/server-ux",
99
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
1010
"license": "AGPL-3",
11-
"application": False,
1211
"installable": True,
1312
"depends": [
1413
"web",
@@ -23,6 +22,6 @@
2322
"qweb": [
2423
"static/src/xml/date_range.xml",
2524
],
26-
'development_status': 'Mature',
27-
'maintainers': ['lmignon'],
25+
"development_status": "Mature",
26+
"maintainers": ["lmignon"],
2827
}

date_range/migrations/11.0.2.0.0/noupdate_changes.xml

-9
This file was deleted.

date_range/migrations/11.0.2.0.0/openupgrade_analysis.txt

-3
This file was deleted.

date_range/migrations/11.0.2.0.0/openupgrade_analysis_work.txt

-4
This file was deleted.

date_range/migrations/11.0.2.0.0/post-migration.py

-11
This file was deleted.

date_range/models/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
21
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
32

43
from . import date_range_type

date_range/models/date_range.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
1+
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4-
from odoo import api, fields, models
5-
from odoo.tools.translate import _
4+
from odoo import _, api, fields, models
65
from odoo.exceptions import ValidationError
76

87

98
class DateRange(models.Model):
109
_name = "date.range"
10+
_description = "Date Range"
1111
_order = "type_name,date_start"
1212

1313
@api.model
@@ -22,7 +22,7 @@ def _default_company(self):
2222
ondelete='restrict', domain="['|', ('company_id', '=', company_id), "
2323
"('company_id', '=', False)]")
2424
type_name = fields.Char(
25-
string='Type', related='type_id.name', readonly=True, store=True)
25+
related='type_id.name', readonly=True, store=True, string="Type Name")
2626
company_id = fields.Many2one(
2727
comodel_name='res.company', string='Company', index=1,
2828
default=_default_company)
@@ -34,7 +34,7 @@ def _default_company(self):
3434
('date_range_uniq', 'unique (name,type_id, company_id)',
3535
'A date range must be unique per company !')]
3636

37-
@api.onchange('company_id')
37+
@api.onchange('company_id', 'type_id')
3838
def _onchange_company_id(self):
3939
if self.company_id and self.type_id.company_id and \
4040
self.type_id.company_id != self.company_id:
@@ -54,9 +54,7 @@ def _check_company_id_type_id(self):
5454
@api.constrains('type_id', 'date_start', 'date_end', 'company_id')
5555
def _validate_range(self):
5656
for this in self:
57-
start = fields.Date.from_string(this.date_start)
58-
end = fields.Date.from_string(this.date_end)
59-
if start > end:
57+
if this.date_start > this.date_end:
6058
raise ValidationError(
6159
_("%s is not a valid range (%s > %s)") % (
6260
this.name, this.date_start, this.date_end))

date_range/models/date_range_type.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
1+
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4-
from odoo import api, fields, models
5-
from odoo.tools.translate import _
4+
from odoo import _, api, fields, models
65
from odoo.exceptions import ValidationError
76

87

98
class DateRangeType(models.Model):
109
_name = "date.range.type"
10+
_description = "Date Range Type"
1111

1212
@api.model
1313
def _default_company(self):
@@ -18,8 +18,8 @@ def _default_company(self):
1818
help="If sets date range of same type must not overlap.",
1919
default=False)
2020
active = fields.Boolean(
21-
help="The active field allows you to hide the date range without "
22-
"removing it.", default=True)
21+
help="The active field allows you to hide the date range type "
22+
"without removing it.", default=True)
2323
company_id = fields.Many2one(
2424
comodel_name='res.company', string='Company', index=1,
2525
default=_default_company)
@@ -35,10 +35,10 @@ def _check_company_id(self):
3535
for rec in self.sudo():
3636
if not rec.company_id:
3737
continue
38-
if bool(self.date_range_ids.filtered(
38+
if bool(rec.date_range_ids.filtered(
3939
lambda r: r.company_id and
4040
r.company_id != rec.company_id)):
4141
raise ValidationError(
4242
_('You cannot change the company, as this '
4343
'Date Range Type is assigned to Date Range '
44-
'(%s).') % (self.date_range_ids.name_get()[0][1]))
44+
'(%s).') % (rec.date_range_ids.name_get()[0][1]))

date_range/readme/CONTRIBUTORS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* Laurent Mignon <laurent.mignon@acsone.eu>
22
* Alexis de Lattre <alexis.delattre@akretion.com>
33
* Miquel Raïch <miquel.raich@eficent.com>
4+
* Andrea Stirpe <a.stirpe@onestein.nl>

date_range/readme/INSTALL.rst

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
The addon use the daterange method from postgres. This method is supported as of postgresql 9.2
2-
3-

0 commit comments

Comments
 (0)