-
-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This change is necessary to add quarterly period: Adding a quarter period type Improved fiscal period . Fixes #622 . #643
base: 17.0
Are you sure you want to change the base?
Changes from 3 commits
7494142
304caf9
be2d7e5
f616a3e
a903d92
0ed79a3
870b71d
033f6cd
a54c2df
806ac56
0628040
e523cd6
54568d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ exclude: | | |
# Files and folders generated by bots, to avoid loops | ||
^setup/|/static/description/index\.html$| | ||
# We don't want to mess with tool-generated files | ||
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| | ||
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs| | ||
# Maybe reactivate this when all README files include prettier ignore tags? | ||
^README\.md$| | ||
# Library files can have extraneous formatting (even minimized) | ||
|
@@ -39,7 +39,7 @@ repos: | |
language: fail | ||
files: '[a-zA-Z0-9_]*/i18n/en\.po$' | ||
- repo: https://github.com/sbidoul/whool | ||
rev: v0.5 | ||
rev: v1.2 | ||
hooks: | ||
- id: whool-init | ||
- repo: https://github.com/oca/maintainer-tools | ||
|
@@ -64,25 +64,37 @@ repos: | |
hooks: | ||
- id: oca-checks-odoo-module | ||
- id: oca-checks-po | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.7.1 | ||
args: | ||
- --disable=po-pretty-format | ||
- repo: local | ||
hooks: | ||
- id: prettier | ||
name: prettier (with plugin-xml) | ||
entry: prettier | ||
args: | ||
- --write | ||
- --list-different | ||
- --ignore-unknown | ||
types: [text] | ||
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ | ||
language: node | ||
additional_dependencies: | ||
- "[email protected]" | ||
- "@prettier/[email protected]" | ||
args: | ||
- --plugin=@prettier/plugin-xml | ||
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: v8.24.0 | ||
- repo: local | ||
hooks: | ||
- id: eslint | ||
verbose: true | ||
name: eslint | ||
entry: eslint | ||
args: | ||
- --color | ||
- --fix | ||
verbose: true | ||
types: [javascript] | ||
language: node | ||
additional_dependencies: | ||
- "[email protected]" | ||
- "eslint-plugin-jsdoc@" | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
collokip169 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hooks: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,19 @@ def _compute_dates(self): | |
record.date_from = fields.Date.to_string(date_from) | ||
record.date_to = fields.Date.to_string(date_to) | ||
record.valid = True | ||
|
||
elif record.mode == MODE_REL and record.type == "q": # Quarterly period logic | ||
date_from = d.replace(day=1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This always takes the |
||
date_from = date_from + relativedelta(months=record.offset * 3) | ||
date_to = ( | ||
date_from | ||
+ relativedelta(months=(record.duration * 3) - 1) | ||
+ relativedelta(day=31) | ||
) | ||
record.date_from = fields.Date.to_string(date_from) | ||
record.date_to = fields.Date.to_string(date_to) | ||
record.valid = True | ||
|
||
elif record.mode == MODE_REL and record.type == "date_range": | ||
date_range_obj = record.env["date.range"] | ||
current_periods = date_range_obj.search( | ||
|
@@ -190,16 +203,18 @@ def _compute_dates(self): | |
("d", _("Day")), | ||
("w", _("Week")), | ||
("m", _("Month")), | ||
("q", _("quarterly")), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be in line with the others, this needs to be capitalized and the "ly" removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitalized |
||
("y", _("Year")), | ||
("date_range", _("Date Range")), | ||
], | ||
string="Period type", | ||
) | ||
is_ytd = fields.Boolean( | ||
is_ytd = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is a bit weird, normally it's not necessary to put brackets around a field definition |
||
fields.Boolean( | ||
default=False, | ||
string="Year to date", | ||
help="Forces the start date to Jan 1st of the relevant year", | ||
) | ||
)) | ||
date_range_type_id = fields.Many2one( | ||
comodel_name="date.range.type", | ||
string="Date Range Type", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,8 +380,8 @@ | |
invisible="type != 'date_range'" | ||
required="type == 'date_range' and mode == 'relative'" | ||
/> | ||
<field name="offset" /> | ||
<field name="duration" /> | ||
<field name="offset" string="Offset (Quarters)" attrs="{'invisible': [('type', '!=', 'q')]}"/> | ||
<field name="duration" string="Duration (Quarters)" attrs="{'invisible': [('type', '!=', 'q')]}"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a breaking change - why are people not allowed to see the offset and duration in other modes anymore? Eg for month offset and duration are also used, but now it would become invisible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not solved? |
||
</group> | ||
<group> | ||
<field name="date_from" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you adding an extra check?