10
10
11
11
12
12
class PurchaseOrder (models .Model ):
13
- _inherit = [' purchase.order' , ' base.exception' ]
14
- _name = ' purchase.order'
15
- _order = ' main_exception_id asc, date_order desc, name desc'
13
+ _inherit = [" purchase.order" , " base.exception" ]
14
+ _name = " purchase.order"
15
+ _order = " main_exception_id asc, date_order desc, name desc"
16
16
17
17
@api .model
18
18
def test_all_draft_orders (self ):
19
- order_set = self .search ([(' state' , '=' , ' draft' )])
19
+ order_set = self .search ([(" state" , "=" , " draft" )])
20
20
order_set .detect_exceptions ()
21
21
return True
22
22
@@ -26,33 +26,35 @@ def _exception_rule_eval_context(self, rec):
26
26
# We keep this only for backward compatibility
27
27
res = super ()._exception_rule_eval_context (rec )
28
28
if res .get ("purchase" ):
29
- logger .warning ("""
29
+ logger .warning (
30
+ """
30
31
For a full compatibility with future versions of this module,
31
32
please use 'self' instead of 'purchase' in your
32
33
custom exceptions rules.
33
- """ )
34
- res ['purchase' ] = rec
34
+ """
35
+ )
36
+ res ["purchase" ] = rec
35
37
return res
36
38
37
39
@api .model
38
40
def _reverse_field (self ):
39
- return ' purchase_ids'
41
+ return " purchase_ids"
40
42
41
43
def detect_exceptions (self ):
42
44
all_exceptions = super ().detect_exceptions ()
43
- lines = self .mapped (' order_line' )
45
+ lines = self .mapped (" order_line" )
44
46
all_exceptions += lines .detect_exceptions ()
45
47
return all_exceptions
46
48
47
- @api .constrains (' ignore_exception' , ' order_line' , ' state' )
49
+ @api .constrains (" ignore_exception" , " order_line" , " state" )
48
50
def purchase_check_exception (self ):
49
- orders = self .filtered (lambda s : s .state == ' purchase' )
51
+ orders = self .filtered (lambda s : s .state == " purchase" )
50
52
if orders :
51
53
orders ._check_exception ()
52
54
53
- @api .onchange (' order_line' )
55
+ @api .onchange (" order_line" )
54
56
def onchange_ignore_exception (self ):
55
- if self .state == ' purchase' :
57
+ if self .state == " purchase" :
56
58
self .ignore_exception = False
57
59
58
60
@api .multi
@@ -72,6 +74,5 @@ def button_draft(self):
72
74
73
75
@api .model
74
76
def _get_popup_action (self ):
75
- action = self .env .ref (
76
- 'purchase_exception.action_purchase_exception_confirm' )
77
+ action = self .env .ref ("purchase_exception.action_purchase_exception_confirm" )
77
78
return action
0 commit comments