[REF] account_move_name_sequence: rename hooks file
Rename hooks file and use post_init_hook method to create journal sequences after module installation.
This commit is contained in:
parent
cf5a2e9bd5
commit
79c62a9af6
@ -1,2 +1,2 @@
|
|||||||
from .post_install import create_journal_sequences
|
from .hooks import post_init_hook
|
||||||
from . import models
|
from . import models
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"summary": "Generate journal entry number from sequence",
|
"summary": "Generate journal entry number from sequence",
|
||||||
"author": "Akretion,Vauxoo,Odoo Community Association (OCA)",
|
"author": "Akretion,Vauxoo,Odoo Community Association (OCA)",
|
||||||
"maintainers": ["alexis-via", "moylop260", "frahikLV"],
|
"maintainers": ["alexis-via", "moylop260", "frahikLV", "luisg123v"],
|
||||||
"website": "https://github.com/OCA/account-financial-tools",
|
"website": "https://github.com/OCA/account-financial-tools",
|
||||||
"depends": [
|
"depends": [
|
||||||
"account",
|
"account",
|
||||||
@ -22,6 +22,6 @@
|
|||||||
"views/account_move.xml",
|
"views/account_move.xml",
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
],
|
],
|
||||||
"post_init_hook": "create_journal_sequences",
|
"post_init_hook": "post_init_hook",
|
||||||
"installable": True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,12 @@
|
|||||||
from odoo import SUPERUSER_ID, api
|
from odoo import SUPERUSER_ID, api
|
||||||
|
|
||||||
|
|
||||||
def create_journal_sequences(cr, registry):
|
def post_init_hook(cr, registry):
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
create_journal_sequences(env)
|
||||||
|
|
||||||
|
|
||||||
|
def create_journal_sequences(env):
|
||||||
journals = (
|
journals = (
|
||||||
env["account.journal"]
|
env["account.journal"]
|
||||||
.with_context(active_test=False)
|
.with_context(active_test=False)
|
Loading…
Reference in New Issue
Block a user