You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
793 B
29 lines
793 B
# Copyright 2021 Open Source Integrators
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class Partner(models.Model):
|
|
|
|
_inherit = "res.partner"
|
|
|
|
@api.model
|
|
def _get_default_stage_id(self):
|
|
return self.env["res.partner.stage"].search(
|
|
[("is_default", "=", True)], limit=1
|
|
)
|
|
|
|
@api.model
|
|
def _read_group_stage_id(self, states, domain, order):
|
|
return states.search([])
|
|
|
|
stage_id = fields.Many2one(
|
|
comodel_name="res.partner.stage",
|
|
group_expand="_read_group_stage_id",
|
|
default=_get_default_stage_id,
|
|
copy=False,
|
|
index=True,
|
|
tracking=True,
|
|
)
|
|
state = fields.Selection(related="stage_id.state", store=True, readonly=True)
|