-
-
Notifications
You must be signed in to change notification settings - Fork 310
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?
Conversation
Hi @sbidoul, |
okay |
okay |
@thomaspaulb could you please review this when you have time? |
This needs to be in the description of the PR, you can edit it there and remove this |
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?
git-diagnostics-2024-10-23-0823.zip
Outdated
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.
What is this ZIP file doing here
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.
You cant remove copyright headers
odoo-pre-commit-hooks
Outdated
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.
New submodule?
@@ -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 comment
The 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 comment
The 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 comment
The 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
<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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Not solved?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
This always takes the date_from
as the start of the month, but in case of quarterly logic, it should be the start of the quarter that the d
date falls in.
@@ -133,6 +133,27 @@ 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.month(month=1) |
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.
month
is not a function it's an integer, so this gives an error
elif d.month in [7, 8, 9]: | ||
date_from = d.replace(month=7, day=1) # Q3 | ||
else: | ||
date_from = d.replace(month=10, day=1) # Q4 |
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.
You could combine this to date_from = replace(month=(datetime(2024, 7, 7).month - 1) % 3 + 1)
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
Not solved?
Hi, thanks a lot for contributing! Could you please do a clean PR with only the changes to |
And proper commit message: https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#commit-message and with green CI. |
This pull request seeks to add quarterly period . Adding a quarter period type Improved fiscal period . Fixes #622 . #643