37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
# Copyright 2025-Today Criptomart
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
|
|
|
from odoo import _, fields, models
|
|
|
|
|
|
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,
|
|
)
|