mirror of
https://github.com/bringout/oca-project.git
synced 2026-04-18 14:21:59 +02:00
Move 124 sale modules to oca-sale, create oca-project with 56 project modules from oca-workflow-process
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9eb7ae5807
commit
6094c218b2
2332 changed files with 125826 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright 2016 Tecnativa <vicent.cubells@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def pre_init_hook(cr):
|
||||
"""
|
||||
With this pre-init-hook we want to avoid error when creating the UNIQUE
|
||||
code constraint when the module is installed and before the post-init-hook
|
||||
is launched.
|
||||
"""
|
||||
cr.execute("ALTER TABLE project_task ADD COLUMN code character varying;")
|
||||
cr.execute("UPDATE project_task SET code = id;")
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
"""
|
||||
This post-init-hook will update all existing task assigning them the
|
||||
corresponding sequence code.
|
||||
"""
|
||||
env = api.Environment(cr, SUPERUSER_ID, dict())
|
||||
task_obj = env["project.task"]
|
||||
sequence_obj = env["ir.sequence"]
|
||||
tasks = task_obj.search([], order="id")
|
||||
for task_id in tasks.ids:
|
||||
cr.execute(
|
||||
"UPDATE project_task SET code = %s WHERE id = %s;",
|
||||
(
|
||||
sequence_obj.next_by_code("project.task"),
|
||||
task_id,
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue