- Add mypy.ini configuration to exclude migration scripts - Rename migration files to proper snake_case (post-migration.py → post_migration.py) - Add __init__.py to migration directories for proper Python package structure - Add new portal access tests for website_sale_aplicoop - Code formatting improvements (black, isort) - Update copilot instructions and project configuration Related to previous code quality refactoring work.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
# Copyright 2025-Today Criptomart
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
|
|
|
from odoo import fields
|
|
from odoo import models
|
|
|
|
# Note: translation function _ is not used in this module (removed to satisfy flake8)
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = "res.partner"
|
|
|
|
# Campo para identificar si un partner es un grupo
|
|
is_group = fields.Boolean(
|
|
string="Is a Consumer Group?",
|
|
help="Check this box if the partner represents a group of users",
|
|
default=False,
|
|
)
|
|
|
|
# Relación para los miembros de un grupo (si is_group es True)
|
|
member_ids = fields.Many2many(
|
|
"res.partner",
|
|
"res_partner_group_members_rel",
|
|
"group_id",
|
|
"member_id",
|
|
domain=[("is_group", "=", True)],
|
|
string="Consumer Groups",
|
|
help="Consumer Groups this partner belongs to",
|
|
)
|
|
|
|
# Inverse relation: group orders this group participates in
|
|
group_order_ids = fields.Many2many(
|
|
"group.order",
|
|
"group_order_group_rel",
|
|
"group_id",
|
|
"order_id",
|
|
string="Consumer Group Orders",
|
|
help="Group orders this consumer group participates in",
|
|
readonly=True,
|
|
)
|