Skip to content
Snippets Groups Projects
Commit 87feab584f36 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Don't rebuild existing fiscal years

This would happen when running tests on a DB where ``account_period`` is
already installed.

Follow-up on rev e9cc0fe9ab5f.
parent e9cc0fe9ab5f
No related branches found
No related tags found
1 merge request!18Don't rebuild existing fiscal years
Pipeline #35340 passed
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"name": "Accounting Periods", "name": "Accounting Periods",
"license": "AGPL-3", "license": "AGPL-3",
"summary": "Add period accounting concept", "summary": "Add period accounting concept",
"version": "13.0.1.2.0", "version": "13.0.1.2.1",
"category": "Accounting/Accounting", "category": "Accounting/Accounting",
"author": "XCG Consulting", "author": "XCG Consulting",
"website": "https://odoo.consulting/", "website": "https://odoo.consulting/",
......
...@@ -56,6 +56,11 @@ ...@@ -56,6 +56,11 @@
) )
year_str = str(end_date.year) year_str = str(end_date.year)
if self.env["account.fiscalyear"].search(
[("code", "=", year_str)], limit=1
):
return # Fiscal year already exists in this company.
self.env["account.fiscalyear"].create( self.env["account.fiscalyear"].create(
{ {
"code": year_str, "code": year_str,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment