-
Notifications
You must be signed in to change notification settings - Fork 1
/
models_res_config.go
executable file
·64 lines (61 loc) · 2.19 KB
/
models_res_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package project
import (
"github.com/hexya-erp/hexya/src/models"
"github.com/hexya-erp/hexya/src/models/types"
"github.com/hexya-erp/pool/h"
)
func init() {
h.ProjectConfigSettings().DeclareModel()
h.ProjectConfigSettings().AddFields(map[string]models.FieldDefinition{
"CompanyId": models.Many2OneField{
RelationModel: h.Company(),
String: "Company",
Required: true,
Default: func(env models.Environment) interface{} { return env.Uid().company_id },
},
"ProjectTimeModeId": models.Many2OneField{
Related: `CompanyId.ProjectTimeModeId`,
String: "Project Time Unit *",
},
"ModulePad": models.SelectionField{
Selection: types.Selection{
"": "Task description is plain text",
"": "Collaborative rich text on task description",
},
String: "Pads",
Help: "Lets the company customize which Pad installation should" +
"be used to link to new pads (for example: http://ietherpad.com/)." +
"-This installs the module pad.",
},
"ModuleRatingProject": models.SelectionField{
Selection: types.Selection{
"": "No customer rating",
"": "Track customer satisfaction on tasks",
},
String: "Rating on task",
Help: "This allows customers to give rating on provided services",
},
"GenerateProjectAlias": models.SelectionField{
Selection: types.Selection{
"": "Do not create an email alias automatically",
"": "Automatically generate an email alias at the project creation",
},
String: "Project Alias",
Help: "Odoo will generate an email alias at the project creation" +
"from project name.",
},
"ModuleProjectForecast": models.BooleanField{
String: "Forecasts, planning and Gantt charts",
},
})
h.ProjectConfigSettings().Methods().SetDefaultGenerateProjectAlias().DeclareMethod(
`SetDefaultGenerateProjectAlias`,
func(rs m.ProjectConfigSettingsSet) {
// check = self.env.user.has_group('base.group_system')
// Values = check and self.env['ir.values'].sudo(
// ) or self.env['ir.values']
// for config in self:
// Values.set_default('project.config.settings',
// 'generate_project_alias', config.generate_project_alias)
})
}