-
-
Notifications
You must be signed in to change notification settings - Fork 247
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] [MIG] account_fiscal_year_closing #248
base: 16.0
Are you sure you want to change the base?
Conversation
Will this be merged? |
b05e291
to
4917d69
Compare
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!
Please squash the commits as described in https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate.
account_type_id = fields.Many2one( | ||
comodel_name="account.account.type", | ||
string="Account type", | ||
account_type = fields.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.
This change requires a migration, otherwise when a database is migrated the existing records will have an empty account_type
instead of having the value corresponding to their old account_type_id
.
You can have a look at https://oca.github.io/OpenUpgrade for better understanding what a migration is.
Since the migration is usually not trivial and it does not really affect the module's behavior, sometimes this can be done later; this will be probably decided by whoever wants to merge this module.
If this is the case, please at least write a note in the roadmap of the module.
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.
create migration
await you feedback
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 in [ | ||
"asset_receivable", # Receivable | ||
"asset_current", # Current Assets | ||
"income", # Current Assets |
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.
"income", # Current Assets | |
"income", # Income |
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.
done
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.
👍
4917d69
to
a36c164
Compare
8a0946f
to
92f8abb
Compare
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.
Commit 21851e9 is missing from history
account_type_id = fields.Many2one( | ||
comodel_name="account.account.type", | ||
string="Account type", | ||
account_type = fields.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.
👍
not in [ | ||
"asset_receivable", # Receivable | ||
"asset_current", # Current Assets | ||
"income", # Current Assets |
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.
👍
92f8abb
to
18480fd
Compare
done |
596da34
to
3142b69
Compare
@gjlong68, can you check again, please? |
3142b69
to
6d874db
Compare
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.
multi company fix
<field name="global" eval="True" /> | ||
<field | ||
name="domain_force" | ||
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> |
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.
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> | |
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> |
<field name="global" eval="True" /> | ||
<field | ||
name="domain_force" | ||
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> |
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.
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> | |
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> |
6d874db
to
646f046
Compare
@GSLabIt thanks for suggest |
Borruso:OK |
646f046
to
92367bb
Compare
Hi guys, thanks for your job. Has anyone tested the migration script? On my side, it's KO (I'm on Odoo.sh), the pre-mig script doesn't work. |
I didn't
Then please add that as a review to the PR, have a look at https://odoo-community.org/resources/review if you don't know how. |
Please include 55998e8 in this PR. |
/ocabot migration account_fiscal_year_closing |
Currently translated at 92.1% (105 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 92.1% (105 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 92.9% (106 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 100.0% (114 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 100.0% (114 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 100.0% (114 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
Currently translated at 95.6% (109 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/pt_BR/
…s canceled entries in closing
Currently translated at 100.0% (114 of 114 strings) Translation: account-closing-14.0/account-closing-14.0-account_fiscal_year_closing Translate-URL: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing/it/
b6e7c5c
to
4c886b7
Compare
def migrate(env, version): | ||
|
||
all_account_type = [ | ||
("asset_receivable", env.ref("account.data_account_type_receivable").id), |
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.
When migrating from v15 to v16 using OpenUpgrade, the following error occurs:
2024-07-30 09:16:17,113 2133688 INFO cbx_2024-07-30_v16 odoo.modules.loading: Loading module account_fiscal_year_closing (102/170)
2024-07-30 09:16:17,430 2133688 INFO cbx_2024-07-30_v16 odoo.modules.migration: module account_fiscal_year_closing: Running migration [>16.0.1.0.0] pre-migration
2024-07-30 09:16:17,444 2133688 INFO cbx_2024-07-30_v16 OpenUpgrade: account_fiscal_year_closing: pre-migration script called with version 15.0.1.0.0
2024-07-30 09:16:17,444 2133688 ERROR cbx_2024-07-30_v16 OpenUpgrade: account_fiscal_year_closing: error in migration script /opt/odoo/local/addons-oca-community/addons/account_fiscal_year_closing/migrations/16.0.1.0.0/pre-migration.py: 'account.account.type'
2024-07-30 09:16:17,444 2133688 ERROR cbx_2024-07-30_v16 OpenUpgrade: 'account.account.type'
Traceback (most recent call last):
File "/srv/odoo/venv/lib/python3.10/site-packages/openupgradelib/openupgrade.py", line 2292, in wrapped_function
func(
File "/opt/odoo/local/addons-oca-community/addons/account_fiscal_year_closing/migrations/16.0.1.0.0/pre-migration.py", line 31, in migrate
("asset_receivable", env.ref("account.data_account_type_receivable").id),
File "/opt/odoo/src/odoo/odoo/api.py", line 600, in ref
record = self[res_model].browse(res_id)
File "/opt/odoo/local/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/api.py", line 39, in __getitem__
return Environment.__getitem__._original_method(self, model_name)
File "/opt/odoo/src/odoo/odoo/api.py", line 550, in __getitem__
return self.registry[model_name](self, (), ())
File "/opt/odoo/src/odoo/odoo/modules/registry.py", line 190, in __getitem__
return self.models[model_name]
KeyError: 'account.account.type'
2024-07-30 09:16:17,500 2133688 WARNING cbx_2024-07-30_v16 odoo.modules.loading: Transient module states were reset
2024-07-30 09:16:17,501 2133688 ERROR cbx_2024-07-30_v16 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/opt/odoo/src/odoo/odoo/modules/registry.py", line 90, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 484, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 372, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 183, in load_module_graph
migrations.migrate_module(package, 'pre')
File "/opt/odoo/local/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/modules/migration.py", line 18, in migrate_module
MigrationManager.migrate_module._original_method(self, pkg, stage)
File "/opt/odoo/src/odoo/odoo/modules/migration.py", line 189, in migrate_module
migrate(self.cr, installed_version)
File "/srv/odoo/venv/lib/python3.10/site-packages/openupgradelib/openupgrade.py", line 2292, in wrapped_function
func(
File "/opt/odoo/local/addons-oca-community/addons/account_fiscal_year_closing/migrations/16.0.1.0.0/pre-migration.py", line 31, in migrate
("asset_receivable", env.ref("account.data_account_type_receivable").id),
File "/opt/odoo/src/odoo/odoo/api.py", line 600, in ref
record = self[res_model].browse(res_id)
File "/opt/odoo/local/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/api.py", line 39, in __getitem__
return Environment.__getitem__._original_method(self, model_name)
File "/opt/odoo/src/odoo/odoo/api.py", line 550, in __getitem__
return self.registry[model_name](self, (), ())
File "/opt/odoo/src/odoo/odoo/modules/registry.py", line 190, in __getitem__
return self.models[model_name]
KeyError: 'account.account.type'
2024-07-30 09:16:17,501 2133688 CRITICAL cbx_2024-07-30_v16 odoo.service.server: Failed to initialize database `cbx_2024-07-30_v16`.
Traceback (most recent call last):
File "/opt/odoo/src/odoo/odoo/service/server.py", line 1310, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "<decorator-gen-16>", line 2, in new
File "/opt/odoo/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/opt/odoo/src/odoo/odoo/modules/registry.py", line 90, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 484, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 372, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo/src/odoo/odoo/modules/loading.py", line 183, in load_module_graph
migrations.migrate_module(package, 'pre')
File "/opt/odoo/local/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/modules/migration.py", line 18, in migrate_module
MigrationManager.migrate_module._original_method(self, pkg, stage)
File "/opt/odoo/src/odoo/odoo/modules/migration.py", line 189, in migrate_module
migrate(self.cr, installed_version)
File "/srv/odoo/venv/lib/python3.10/site-packages/openupgradelib/openupgrade.py", line 2292, in wrapped_function
func(
File "/opt/odoo/local/addons-oca-community/addons/account_fiscal_year_closing/migrations/16.0.1.0.0/pre-migration.py", line 31, in migrate
("asset_receivable", env.ref("account.data_account_type_receivable").id),
File "/opt/odoo/src/odoo/odoo/api.py", line 600, in ref
record = self[res_model].browse(res_id)
File "/opt/odoo/local/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/api.py", line 39, in __getitem__
return Environment.__getitem__._original_method(self, model_name)
File "/opt/odoo/src/odoo/odoo/api.py", line 550, in __getitem__
return self.registry[model_name](self, (), ())
File "/opt/odoo/src/odoo/odoo/modules/registry.py", line 190, in __getitem__
return self.models[model_name]
KeyError: 'account.account.type'
We believe that there is a timing issue with this pre-migration script, because at this stage, those records are already deleted and therefore the keyerror occurs
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.
update pre-migration
can you check again?
4c886b7
to
b54b04a
Compare
When creating from scratch, Mapping is used as an Array instead of simple id (due to many in another many). When coming from a template, id is used To take into account this particularity, check the type before taking the id of the array.
b54b04a
to
0e5cd59
Compare
UPDATE {table} aa | ||
SET account_type = atm.account_type | ||
FROM account_type_map atm | ||
WHERE atm.user_type_id = aa.user_type_id |
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.
ERROR: column aa.user_type_id does not exist
LINE 35: WHERE atm.user_type_id = aa.user_type_id
^
HINT: Perhaps you meant to reference the column "atm.user_type_id".
user_type_id does not exist in any of the two tables? (account_fiscalyear_closing_type_template, account_fiscalyear_closing_type)
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.
yes field user_type_id become account_type
odoo/odoo@26b2472 user_type_id
-> account_type
account.account.type
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.
I proposed Borruso#1 to support the flow where accounting data is created without loading a template chart of accounts
Hello guys, Where can I translate this module for version 16? It's not on Weblate. Also as I see it it is not yet merged into the 16.0 branch either right? |
can you enable runboat? |
a3c19a5
to
cc851f5
Compare
Although we originally developped the module, we figured out soon that this approach is not correct, so we prefer to not appearing in the credits.
cc851f5
to
ff71bb5
Compare
commit included |
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.
Functional test: OK
This PR has the |
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.
Functional: LGTM
Migration account_fiscal_year_closing from 14.0 to 16.0
--
Confermo di aver firmato il CLA https://odoo-community.org/page/cla e di aver letto le linee guida su https://odoo-community.org/page/contributing