1
1
# Copyright 2018 - 2023 The Open Source Company ((www.tosc.nl).)
2
2
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
3
4
- import json
5
4
from datetime import timedelta
6
5
7
6
from dateutil .relativedelta import relativedelta
@@ -39,11 +38,6 @@ class Lead(models.Model):
39
38
"lead_id" ,
40
39
string = "Revenue split" ,
41
40
)
42
- dept_ou_domain = fields .Char (
43
- compute = "_compute_dept_ou_domain" ,
44
- readonly = True ,
45
- store = False ,
46
- )
47
41
48
42
@api .depends ("monthly_revenue_ids.date" )
49
43
def _compute_latest_revenue_date (self ):
@@ -66,42 +60,6 @@ def _compute_show_recalculate_total_button(self):
66
60
this .expected_revenue != this .sum_monthly_revenue
67
61
)
68
62
69
- @api .depends ("operating_unit_id" )
70
- def _compute_dept_ou_domain (self ):
71
- """
72
- Compute the domain for the department domain.
73
- """
74
- department_ids = []
75
- if self .operating_unit_id :
76
- self .env .cr .execute (
77
- """
78
- SELECT id
79
- FROM hr_department
80
- WHERE operating_unit_id = %s
81
- AND parent_id IS NULL
82
- """ ,
83
- (self .operating_unit_id .id ,),
84
- )
85
-
86
- result = self .env .cr .fetchall ()
87
- for res in result :
88
- department_id = res [0 ]
89
- self .env .cr .execute (
90
- """
91
- WITH RECURSIVE
92
- subordinates AS(
93
- SELECT id, parent_id FROM hr_department WHERE id = %s
94
- UNION
95
- SELECT h.id, h.parent_id FROM hr_department h
96
- INNER JOIN subordinates s ON s.id = h.parent_id)
97
- SELECT * FROM subordinates""" ,
98
- (department_id ,),
99
- )
100
- result2 = self .env .cr .fetchall ()
101
- for res2 in result2 :
102
- department_ids .append (res2 [0 ])
103
- self .dept_ou_domain = json .dumps ([("id" , "in" , department_ids )])
104
-
105
63
@api .model
106
64
def default_get (self , fields ):
107
65
res = super ().default_get (fields )
0 commit comments