20
20
##############################################################################
21
21
from openerp .osv import orm , fields
22
22
23
+
23
24
class ProjectClassification (orm .Model ):
24
25
_name = "project.classification"
25
26
_description = "Project classification"
26
27
27
- _columns = {
28
+ _columns = {
28
29
'name' : fields .char ('Classification Name' , required = True , size = 64 ),
29
- 'project_id' :fields .many2one ('account.analytic.account' , 'Parent project' , help = "The parent\
30
- project that will be set when choosing this classification in a project." , required = True ),
31
- 'to_invoice' : fields .many2one ('hr_timesheet_invoice.factor' , 'Reinvoice Costs' ,
32
- help = "Fill this field if you plan to automatically generate invoices based " \
33
- "on the costs in this classification" ),
30
+ 'project_id' :
31
+ fields .many2one ('account.analytic.account' ,
32
+ 'Parent project' ,
33
+ help = "The parent project that will be set when "
34
+ "choosing this classification in a project." ,
35
+ required = True ),
36
+ 'to_invoice' : fields .many2one ('hr_timesheet_invoice.factor' ,
37
+ 'Reinvoice Costs' ,
38
+ help = "Fill this field if you plan to "
39
+ "automatically generate invoices based "
40
+ "on the costs in this classification" ),
34
41
'currency_id' : fields .many2one ('res.currency' , 'Currency' ),
35
42
'user_id' : fields .many2one ('res.users' , 'Account Manager' ),
36
- 'pricelist_id' : fields .many2one ('product.pricelist' , 'Sale Pricelist' ,),
43
+ 'pricelist_id' : fields .many2one ('product.pricelist' ,
44
+ 'Sale Pricelist' ,),
37
45
}
38
46
47
+
39
48
class ProjectProject (orm .Model ):
40
49
_inherit = "project.project"
41
50
@@ -52,24 +61,33 @@ def _child_project_compute(self, cr, uid, ids, name, arg, context=None):
52
61
continue
53
62
child_projects += account_child .project_ids
54
63
55
- result [project .id ] = [child_project .id for child_project in child_projects ]
64
+ result [project .id ] = [child_project .id for child_project
65
+ in child_projects ]
56
66
return result
57
67
58
68
def onchange_classification_id (self , cr , uid , ids , classification_id ):
59
- classification = self .pool .get ('project.classification' ). browse ( cr , uid , classification_id )
60
- return { 'value' :{
61
- 'parent_id' : classification . project_id . id ,
62
- 'to_invoice ' : classification .to_invoice .id or False ,
63
- 'currency_id ' : classification .currency_id .id or False ,
64
- 'user_id ' : classification .user_id .id or False ,
65
- 'pricelist_id ' : classification .pricelist_id .id or False ,
66
- }}
69
+ projclass = self .pool .get ('project.classification' )
70
+ classification = projclass . browse ( cr , uid , classification_id )
71
+ return { 'value' :
72
+ { 'parent_id ' : classification .project_id .id ,
73
+ 'to_invoice ' : classification .to_invoice .id or False ,
74
+ 'currency_id ' : classification .currency_id .id or False ,
75
+ 'user_id ' : classification .user_id .id or False ,
76
+ 'pricelist_id' : classification . pricelist_id . id or False }}
67
77
68
- _columns = {
69
- 'classification_id' :fields .many2one ('project.classification' , 'Classification' , help = "This will automatically set the parent " \
70
- "project as well as other default values define for this kind project (like pricelist, invoice factor,..)" , required = True ),
71
- 'child_project_complete_ids' : fields .function (_child_project_compute ,
72
- relation = 'project.project' , method = True , string = "Project Hierarchy" , type = 'many2many' ),
78
+ _columns = {
79
+ 'classification_id' :
80
+ fields .many2one ('project.classification' , 'Classification' ,
81
+ help = "This will automatically set the parent "
82
+ "project as well as other default values define "
83
+ "for this kind project (like pricelist, "
84
+ "invoice factor,..)" ,
85
+ required = True ),
86
+ 'child_project_complete_ids' :
87
+ fields .function (_child_project_compute ,
88
+ relation = 'project.project' ,
89
+ method = True ,
90
+ string = "Project Hierarchy" , type = 'many2many' ),
73
91
}
74
92
75
93
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0 commit comments