Aplicoop desde el repo de kidekoop
This commit is contained in:
parent
69917d1ec2
commit
7cff89e418
93 changed files with 313992 additions and 0 deletions
30
website_sale_aplicoop/migrations/18.0.1.0.2/post-migrate.py
Normal file
30
website_sale_aplicoop/migrations/18.0.1.0.2/post-migrate.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright 2025 Criptomart
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
"""Migración para agregar soporte multicompañía.
|
||||
|
||||
- Asignar company_id a los registros existentes de group.order
|
||||
- Usar la compañía por defecto del sistema
|
||||
"""
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
|
||||
# Obtener la compañía por defecto
|
||||
default_company = env['res.company'].search([], limit=1)
|
||||
|
||||
if default_company:
|
||||
# Actualizar todos los registros de group.order que no tengan company_id
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE group_order
|
||||
SET company_id = %s
|
||||
WHERE company_id IS NULL
|
||||
""",
|
||||
(default_company.id,)
|
||||
)
|
||||
|
||||
cr.commit()
|
||||
print(f"✓ Asignado company_id={default_company.id} a group.order")
|
||||
Loading…
Add table
Add a link
Reference in a new issue