Skip to content
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

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

legalsylvain
Copy link
Contributor

Hi, three simple commits to improve account_fiscal_year module.

  • 359b71b : factorize code, adding a new function in account.fiscal.year model.
  • b920c77 : Add fields start date and end date of the current fiscal year on res.company model, and display on the views
  • c68335b : improve documentation, adding screenshots

New description

This module allows to create and edit fiscal years from the menu:

Invoicing > Configuration > Accounting > Fiscal Years

account_fiscal_year_form

The start and end dates of the current fiscal years are then available in the company tree and form views.

res_company_tree

@OCA-git-bot
Copy link
Contributor

Hi @eLBati,
some modules you are maintaining are being modified, check this out!

@legalsylvain
Copy link
Contributor Author

CC : last contributors : @baimont, @MiquelRForgeFlow, @SirTakobi, @pegonzalezspesol, @AlvaroTForgeFlow

Copy link

@SirTakobi SirTakobi left a 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)

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.

Copy link
Contributor Author

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"""

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):

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

Copy link
Contributor Author

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"]

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

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

(ref. https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#11translations)

Copy link
Contributor Author

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()

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?

@rafaelbn rafaelbn added this to the 16.0 milestone Dec 23, 2022
@rafaelbn
Copy link
Member

Hello @legalsylvain , you have here pending answering the review 👍 🙏

@legalsylvain
Copy link
Contributor Author

Hello @legalsylvain , you have here pending answering the review 👍 🙏

Hi @rafaelbn
I totally missed this one. Thanks for the reminder !

I'll take a look.

Copy link

github-actions bot commented Apr 7, 2024

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 7, 2024
Copy link
Contributor Author

@legalsylvain legalsylvain left a 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
Copy link
Contributor Author

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):
Copy link
Contributor Author

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed. Fixed.

@rafaelbn rafaelbn requested a review from SirTakobi April 7, 2024 18:37
@rafaelbn rafaelbn removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 7, 2024
@rafaelbn
Copy link
Member

rafaelbn commented Apr 7, 2024

/ocabot rebase

@OCA-git-bot
Copy link
Contributor

Congratulations, PR rebased to 16.0.

@OCA-git-bot OCA-git-bot force-pushed the 16.0-account_fiscal_year-refactor branch from c68335b to 5272859 Compare April 7, 2024 18:38
@rafaelbn
Copy link
Member

rafaelbn commented Apr 7, 2024

@SirTakobi test pass could you please review the review? 😄 @legalsylvain attend comments!

Copy link

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 11, 2024
@legalsylvain
Copy link
Contributor Author

@rafaelbn. Could we merge this one ? it is in production since 1 year without any problem.

@rafaelbn
Copy link
Member

Hello @SirTakobi ,

Could we please have your approval here?

Lot of work ❤️

Thank you! 😄

@rafaelbn
Copy link
Member

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1506-by-rafaelbn-bump-minor, awaiting test results.

@rafaelbn
Copy link
Member

Done @legalsylvain !

@OCA-git-bot OCA-git-bot merged commit f8ec450 into OCA:16.0 Aug 14, 2024
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at aafdaa0. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged 🎉 needs review stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants