- Remove redundant string= from 17 field definitions where name matches string value (W8113) - Convert @staticmethod to instance methods in selection methods for proper self.env._() access - Fix W8161 (prefer-env-translation) by using self.env._() instead of standalone _() - Fix W8301/W8115 (translation-not-lazy) by proper placement of % interpolation outside self.env._() - Remove unused imports of odoo._ from group_order.py and sale_order_extension.py - All OCA linting warnings in website_sale_aplicoop main models are now resolved Changes: - website_sale_aplicoop/models/group_order.py: 21 field definitions cleaned - website_sale_aplicoop/models/sale_order_extension.py: 5 field definitions cleaned + @staticmethod conversion - Consistent with OCA standards for addon submission
31 lines
905 B
Python
31 lines
905 B
Python
# Copyright 2025 Criptomart
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
|
|
|
from odoo import SUPERUSER_ID
|
|
from odoo import api
|
|
|
|
|
|
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")
|