-
-
Notifications
You must be signed in to change notification settings - Fork 779
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
[16.0][IMP] account_fiscal_year add fields on res.company #1506
[16.0][IMP] account_fiscal_year add fields on res.company #1506
Conversation
Hi @eLBati, |
CC : last contributors : @baimont, @MiquelRForgeFlow, @SirTakobi, @pegonzalezspesol, @AlvaroTForgeFlow |
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.
Thanks for the PR!
About the commit messages, in general they should explain why a change is done, not what is done: the what can be seen by the changes.
Also please follow https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#71commit-message, more specifically:
-
The commit message
[REF] account_fiscal_year : factorize code
does not explain why that change is done, but only what is done (also, [REF] already says that there is a refactoring); it might be changed with something like allow to override fiscal year search or do not repeat same search?
-
There is no [DOC] prefix (I would squash it with the [IMP] commit)
-
The commit message
[IMP] account_fiscal_year : Add fields start date and end date of the current fiscal year on res.company model, and display on the views
is too long, and also does not explain why that change is done, but only what is done
The only thing that has to be changed is editing the po(t) file.
Everything else is just nitpicking 😄 and is not really needed for merge in my opinion.
@api.model | ||
def _get_fiscal_year(self, company, date_from, date_to): | ||
"""Return a fiscal year for the given company | ||
that contains the two dates. (or False if no fiscal years) |
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 does not return False
when no match is found, but an empty recordset of model account.fiscal.year
.
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.
indeed. Fixed.
def _get_fiscal_year(self, company, date_from, date_to): | ||
"""Return a fiscal year for the given company | ||
that contains the two dates. (or False if no fiscal years) | ||
matches the selection""" |
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.
Maybe this line should be in the parenthesis? Or just removed?
@@ -107,3 +107,17 @@ def _get_overlapping_domain(self): | |||
intersection_domain, | |||
] | |||
) | |||
|
|||
@api.model | |||
def _get_fiscal_year(self, company, date_from, date_to): |
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.
A method account.fiscal.year._get_fiscal_year
looks like a bit vague in my opinion, maybe it can be moved in the company and called _get_fiscal_year_by_date
?
Or it should have a name explaining what it does
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.
Fixed. Thanks.
@@ -20,15 +20,13 @@ def compute_fiscalyear_dates(self, current_date): | |||
""" | |||
self.ensure_one() | |||
|
|||
AccountFiscalYear = self.env["account.fiscal.year"] |
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.
Variable names should use snake_case both because it is the default for variables in Python (https://peps.python.org/pep-0008/#function-and-variable-names) and because the new code should fit in the style of its surroundings.
@@ -48,6 +48,11 @@ msgstr "" | |||
msgid "End Date" | |||
msgstr "" | |||
|
|||
#. module: account_fiscal_year |
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.
po(t) files should not be edited: they are managed by weblate. This is also stated in the guidelines:
Pull requests should never directly modify .po files
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.
Hi. I do not understand that rule.
How can I translate in my own instance, a new field created by an unmerged PR ? how do you do ?
) | ||
|
||
def _compute_fiscal_year_dates(self): | ||
today = fields.Date.today() |
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.
Can a test be added covering this new code?
Hello @legalsylvain , you have here pending answering the review 👍 🙏 |
Hi @rafaelbn I'll take a look. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
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.
Fixed. @rafaelbn is it now OK ?
@@ -48,6 +48,11 @@ msgstr "" | |||
msgid "End Date" | |||
msgstr "" | |||
|
|||
#. module: account_fiscal_year |
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.
Hi. I do not understand that rule.
How can I translate in my own instance, a new field created by an unmerged PR ? how do you do ?
@@ -107,3 +107,17 @@ def _get_overlapping_domain(self): | |||
intersection_domain, | |||
] | |||
) | |||
|
|||
@api.model | |||
def _get_fiscal_year(self, company, date_from, date_to): |
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.
Fixed. Thanks.
@api.model | ||
def _get_fiscal_year(self, company, date_from, date_to): | ||
"""Return a fiscal year for the given company | ||
that contains the two dates. (or False if no fiscal years) |
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.
indeed. Fixed.
/ocabot rebase |
… current fiscal year on res.company model, and display on the views
Congratulations, PR rebased to 16.0. |
c68335b
to
5272859
Compare
@SirTakobi test pass could you please review the review? 😄 @legalsylvain attend comments! |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
@rafaelbn. Could we merge this one ? it is in production since 1 year without any problem. |
Hello @SirTakobi , Could we please have your approval here? Lot of work ❤️ Thank you! 😄 |
/ocabot merge minor |
On my way to merge this fine PR! |
Done @legalsylvain ! |
Congratulations, your PR was merged at aafdaa0. Thanks a lot for contributing to OCA. ❤️ |
Hi, three simple commits to improve
account_fiscal_year
module.New description
This module allows to create and edit fiscal years from the menu:
Invoicing > Configuration > Accounting > Fiscal Years
The start and end dates of the current fiscal years are then available in the company tree and form views.