Merge lp:~jfb-tempo-consulting/unifield-web/US-3961 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4898
Proposed branch: lp:~jfb-tempo-consulting/unifield-web/US-3961
Merge into: lp:unifield-web
Diff against target: 114 lines (+68/-2)
3 files modified
addons/openerp/controllers/database.py (+62/-1)
addons/openerp/controllers/form.py (+1/-1)
addons/openerp/controllers/templates/auto_create_progress.mako (+5/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-web/US-3961
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+340171@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/controllers/database.py'
2--- addons/openerp/controllers/database.py 2017-11-25 10:50:11 +0000
3+++ addons/openerp/controllers/database.py 2018-03-01 09:44:27 +0000
4@@ -442,12 +442,73 @@
5 ('backup', 'auto_bck_interval_unit', ('minutes', 'hours', 'work_days', 'days', 'weeks', 'months')),
6 ('reconfigure', 'delivery_process', ('complex', 'simple')),
7 )
8-
9 for section, option, possible_values in possible_value_list:
10 self.check_possible_value(config, section, option, possible_values)
11 if self.msg:
12 return
13
14+ if config.get('instance', 'instance_level') == 'project':
15+ if len(config.get('instance', 'group_names').split(',')) != 3:
16+ self.msg = {
17+ 'message': _('Project creation asked, you must set 3 sync groups'),
18+ 'title': _('Bad sync groups'),
19+ }
20+ return
21+
22+ if config.get('instance', 'instance_level') == 'coordo':
23+ if len(config.get('instance', 'group_names').split(',')) != 4:
24+ self.msg = {
25+ 'message': _('Project creation asked, you must set 3 sync groups'),
26+ 'title': _('Bad sync groups'),
27+ }
28+ return
29+
30+ protocol = 'http'
31+ if config.get('instance', 'sync_protocol') == 'xmlrpcs':
32+ protocol = 'https'
33+ server_rpc = rpc.RPCSession(config.get('instance', 'sync_host'), config.get('instance', 'sync_port'), protocol=protocol)
34+ uid = server_rpc.login(config.get('instance', 'sync_server'), config.get('instance', 'sync_user'), config.get('instance', 'sync_pwd'))
35+ if uid <= 0:
36+ self.msg = {
37+ 'message': _('Unable to connect to Sync Server %s:%s, db:%s, user:%s') % (config.get('instance', 'sync_host'), config.get('instance', 'sync_port'), config.get('instance', 'sync_server'), config.get('instance', 'sync_user')),
38+ 'title': _('Sync Server Error'),
39+ }
40+ return
41+
42+ config_groups = config.get('instance', 'group_names').split(',')
43+ found_group = []
44+ groups_ids = server_rpc.execute('object', 'execute', 'sync.server.entity_group', 'search', [('name', 'in', config_groups)])
45+ for x in server_rpc.execute('object', 'execute', 'sync.server.entity_group', 'read', groups_ids, ['name', 'oc']):
46+ found_group.append(x['name'])
47+ if x['oc'].lower() != config.get('instance', 'oc').lower():
48+ self.msg = {
49+ 'message': _('Group %s has not the same OC (configured: %s)') % (x['name'], config.get('instance', 'oc')),
50+ 'title': _('Sync Group'),
51+ }
52+ return
53+
54+ if set(config_groups) - set(found_group):
55+ self.msg = {
56+ 'message': _('Sync Groups %s not found on sync server') % (", ".join(list(set(config_groups) - set(found_group)),)),
57+ 'title': _('Sync Group'),
58+ }
59+ return
60+
61+ if not server_rpc.execute('object', 'execute', 'sync.server.entity', 'search', [('name', '=', config.get('instance', 'parent_instance'))]):
62+ self.msg = {
63+ 'message': _('Parent Instance %s not found on sync server') % (config.get('instance', 'parent_instance'), ),
64+ 'title': _('Parent Instance'),
65+ }
66+ return
67+
68+ if not server_rpc.execute('object', 'execute', 'sync.server.update', 'search', [('model', '=', 'msf.instance'), ('values', 'like', "'%s'" % config.get('instance', 'instance_name'))]):
69+ self.msg = {
70+ 'message': _('No update found for %s. Did you create the new instance at HQ ?') % (config.get('instance', 'instance_name'), ),
71+ 'title': _('HQ creation'),
72+ }
73+ return
74+
75+
76 except NoOptionError as e:
77 self.msg = {'message': ustr(_('No option \'%s\' found for the section \'[%s]\' in the config file \'%s\'') % (e.option, e.section, file_path)),
78 'title': ustr(_('Option missing in configuration file'))}
79
80=== modified file 'addons/openerp/controllers/form.py'
81--- addons/openerp/controllers/form.py 2017-10-27 12:14:43 +0000
82+++ addons/openerp/controllers/form.py 2018-03-01 09:44:27 +0000
83@@ -513,7 +513,7 @@
84 # Model.write([params.id], modified, ctx)
85 #else:
86 # Model.write([params.id], data, ctx)
87- Model.write([params.id], data, ctx)
88+ Model.write_web([params.id], data, ctx)
89
90 tw.ConcurrencyInfo.update(
91 params.model, Model.read([params.id], ['__last_update'], ctx)
92
93=== modified file 'addons/openerp/controllers/templates/auto_create_progress.mako'
94--- addons/openerp/controllers/templates/auto_create_progress.mako 2017-11-25 10:50:11 +0000
95+++ addons/openerp/controllers/templates/auto_create_progress.mako 2018-03-01 09:44:27 +0000
96@@ -37,6 +37,7 @@
97 $("div.my_state").text(data.state);
98 if (data.state === 'done') {
99 clearInterval(interval);
100+ $("#login-button").css({'display': 'inline'})
101 };
102 if (data.monitor_status) {
103 $("div.my_monitor_status").text(data.monitor_status);
104@@ -75,6 +76,10 @@
105 <div class="auto_creation_resume">
106 <textarea rows="20" cols="80">${resume}</textarea>
107 </div>
108+
109+ <div id="connect_instance" class="auto_creation_resume">
110+ <a href="/openerp/login/" id="login-button" style="display:none" class="button-a">Open Login Page</a>
111+ </div>
112 </div>
113 <a class="auto_instance_debug" href="/openerp/login/?style=noauto"><img src="/openerp/static/images/icons/idea.png" alt="debug access" /></a>
114 <%include file="footer.mako"/>

Subscribers

People subscribed via source and target branches