addons-cm/product_price_category_supplier
snt 6fbc7b9456 [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings
- 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
2026-02-18 17:54:43 +01:00
..
i18n import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
models [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
security import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
tests [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
views import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
__init__.py import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
__manifest__.py cosmetic 2026-02-12 18:33:57 +01:00
BEFORE_AND_AFTER.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
ERROR_FIX_REPORT.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
IMPLEMENTACION_RESUMEN.txt import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
install_addon.sh import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
INSTALLATION_COMPLETE.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
INSTALLATION_STATUS.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
QUICK_FIX_REFERENCE.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
QUICK_START.sh import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
README.md import desde el repo de kidekoop 2026-02-11 15:33:01 +01:00
README.rst [DOC] website_sale_aplicoop: Add lazy loading documentation and implement v18.0.1.3.0 feature 2026-02-16 18:39:39 +01:00
TEST_REPORT.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
VALIDATION.md [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00

Product Price Category - Supplier Extension

Extiende res.partner (proveedores) con un campo de categoría de precio por defecto y permite actualizar masivamente todos los productos de un proveedor con esta categoría mediante un wizard.

Funcionalidades

  • Campo en Proveedores: Añade campo default_price_category_id en la pestaña "Compras" (Purchases) de res.partner
  • Actualización Masiva: Botón que abre wizard modal para confirmar actualización de todos los productos del proveedor
  • Columna Configurable: Campo oculto en vista tree de partner, visible/configurable desde menú de columnas
  • Control de Permisos: Acceso restringido a sales_team.group_sale_manager (Gestores de Ventas)

Dependencias

  • product_price_category (OCA addon base)
  • product_pricelists_margins_custom (Addon del proyecto)
  • sales_team (Odoo core)

Instalación

docker-compose exec -T odoo odoo -d odoo -u product_price_category_supplier --stop-after-init

Flujo de Uso

  1. Abrir formulario de un Proveedor (res.partner)
  2. Ir a pestaña "Compras" (Purchases)
  3. En sección "Price Category Settings", seleccionar categoría de precio por defecto
  4. Hacer clic en botón "Apply to All Products"
  5. Se abre modal de confirmación mostrando:
    • Nombre del proveedor
    • Categoría de precio a aplicar
    • Cantidad de productos que serán actualizados
  6. Hacer clic "Confirm" para ejecutar actualización en bulk
  7. Notificación de éxito mostrando cantidad de productos actualizados

Campos

res.partner

  • default_price_category_id (Many2one → product.price.category)
    • Ubicación: Pestaña "Compras", sección "Price Category Settings"
    • Obligatorio: No
    • Ayuda: "Default price category for products from this supplier"
    • Visible en tree: Oculto por defecto (column_invisible=1), configurable vía menú

Modelos

wizard.update.product.category (Transient)

  • partner_id (Many2one → res.partner) - Readonly
  • partner_name (Char, related to partner_id.name) - Readonly
  • price_category_id (Many2one → product.price.category) - Readonly
  • product_count (Integer) - Cantidad de productos a actualizar - Readonly

Métodos:

  • action_confirm() - Realiza bulk update de productos y retorna notificación

Vistas

res.partner

  • Form: Campo + botón en pestaña "Compras"
  • Tree: Campo oculto (column_invisible=1)

wizard.update.product.category

  • Form: Formulario modal con información de confirmación y botones

Seguridad

Acceso al wizard restringido a grupo sales_team.group_sale_manager:

  • Lectura: Sí
  • Escritura: Sí
  • Creación: Sí
  • Borrado: Sí

Comportamiento

Actualización de Productos

Cuando el usuario confirma la acción:

  1. Se buscan todos los productos (product.template) donde:

    • default_supplier_id = partner_id (este proveedor es su proveedor por defecto)
  2. Se actualizan en bulk (single SQL UPDATE) con:

    • price_category_id = default_price_category_id
  3. Se retorna notificación de éxito:

    • "X products updated with category 'CATEGORY_NAME'."

Nota: La actualización SOBRESCRIBE cualquier price_category_id existente en los productos.

Extensión Futura

Para implementar defaults automáticos al crear productos desde un proveedor:

# En models/product_template.py
@api.model_create_multi
def create(self, vals_list):
    # Si se proporciona default_supplier_id sin price_category_id,
    # usar default_price_category_id del proveedor
    for vals in vals_list:
        if vals.get('default_supplier_id') and not vals.get('price_category_id'):
            supplier = self.env['res.partner'].browse(vals['default_supplier_id'])
            if supplier.default_price_category_id:
                vals['price_category_id'] = supplier.default_price_category_id.id
    return super().create(vals_list)

Traducciones

Para añadir/actualizar traducciones:

# Exportar strings
docker-compose exec -T odoo odoo -d odoo \
    --addons-path=/mnt/extra-addons/product_price_category_supplier \
    -i product_price_category_supplier \
    --i18n-export=/tmp/product_price_category_supplier.pot \
    --stop-after-init

# Mergar en archivos .po existentes
cd product_price_category_supplier/i18n
for lang in es eu; do
    msgmerge -U ${lang}.po product_price_category_supplier.pot
done

Testing

Ejecutar tests:

docker-compose exec -T odoo odoo -d odoo \
    -i product_price_category_supplier \
    --test-enable --stop-after-init

Autor

Your Company - 2026

Licencia

AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)