mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-19 23:52:03 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import exception_rule
|
||||
from . import crm_lead
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright 2023 Quartile Limited
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
class CrmLead(models.Model):
|
||||
_inherit = ["crm.lead", "base.exception"]
|
||||
_name = "crm.lead"
|
||||
_order = "main_exception_id asc, name desc"
|
||||
|
||||
def write(self, vals):
|
||||
result = super().write(vals)
|
||||
# To avoid a recursive call, write()
|
||||
if "exception_ids" in vals:
|
||||
return result
|
||||
self._check_exception()
|
||||
return result
|
||||
|
||||
@api.model
|
||||
def _reverse_field(self):
|
||||
return "crm_lead_ids"
|
||||
|
||||
def _rule_domain(self):
|
||||
rule_domain = super()._rule_domain()
|
||||
if self.stage_id:
|
||||
rule_domain = expression.AND(
|
||||
[
|
||||
rule_domain,
|
||||
[
|
||||
"|",
|
||||
("stage_ids", "in", tuple(self.stage_id.ids)),
|
||||
("stage_ids", "=", False),
|
||||
],
|
||||
]
|
||||
)
|
||||
return rule_domain
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright 2023 Quartile Limited
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ExceptionRule(models.Model):
|
||||
_inherit = "exception.rule"
|
||||
|
||||
crm_lead_ids = fields.Many2many(comodel_name="crm.lead", string="Opportunities")
|
||||
model = fields.Selection(
|
||||
selection_add=[
|
||||
("crm.lead", "Lead"),
|
||||
],
|
||||
ondelete={"crm.lead": "cascade"},
|
||||
)
|
||||
stage_ids = fields.Many2many(comodel_name="crm.stage")
|
||||
Loading…
Add table
Add a link
Reference in a new issue