Merge lp:~unifield-team/unifield-server/us-1497 into lp:unifield-server

Proposed by Quentin THEURET @Amaris
Status: Merged
Merged at revision: 3861
Proposed branch: lp:~unifield-team/unifield-server/us-1497
Merge into: lp:unifield-server
Diff against target: 72 lines (+23/-4)
2 files modified
bin/addons/msf_profile/msf_profile.py (+13/-3)
bin/service/security.py (+10/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1497
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+300329@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
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2016-06-30 20:39:20 +0000
+++ bin/addons/msf_profile/msf_profile.py 2016-07-18 14:07:23 +0000
@@ -31,6 +31,7 @@
3131
32class patch_scripts(osv.osv):32class patch_scripts(osv.osv):
33 _name = 'patch.scripts'33 _name = 'patch.scripts'
34 _logger = logging.getLogger('patch_scripts')
3435
35 _columns = {36 _columns = {
36 'model': fields.text(string='Model', required=True),37 'model': fields.text(string='Model', required=True),
@@ -48,8 +49,16 @@
48 for ps in ps_obj.read(cr, uid, ps_ids, ['model', 'method']):49 for ps in ps_obj.read(cr, uid, ps_ids, ['model', 'method']):
49 method = ps['method']50 method = ps['method']
50 model_obj = self.pool.get(ps['model'])51 model_obj = self.pool.get(ps['model'])
51 getattr(model_obj, method)(cr, uid, *a, **b)52 try:
52 self.write(cr, uid, [ps['id']], {'run': True})53 getattr(model_obj, method)(cr, uid, *a, **b)
54 self.write(cr, uid, [ps['id']], {'run': True})
55 except Exception as e:
56 err_msg = 'Error with the patch scripts %s.%s :: %s' % (ps['model'], ps['method'], e)
57 self._logger.error(err_msg)
58 raise osv.except_osv(
59 'Error',
60 err_msg,
61 )
5362
54 def us_993_patch(self, cr, uid, *a, **b):63 def us_993_patch(self, cr, uid, *a, **b):
55 # set no_update to True on USB group_type not to delete it on64 # set no_update to True on USB group_type not to delete it on
@@ -653,8 +662,9 @@
653 if setup_br:662 if setup_br:
654 sale_percent = 1 + (setup_br.sale_price/100.00)663 sale_percent = 1 + (setup_br.sale_price/100.00)
655664
665
656 sql = """UPDATE product_template SET standard_price = 1.00, list_price = %s WHERE standard_price = 0.00"""666 sql = """UPDATE product_template SET standard_price = 1.00, list_price = %s WHERE standard_price = 0.00"""
657 cr.execute(sql, (sale_percent,))667 cr.execute(sql, (sale_percent, ))
658 return True668 return True
659669
660patch_scripts()670patch_scripts()
661671
=== modified file 'bin/service/security.py'
--- bin/service/security.py 2016-05-25 09:01:14 +0000
+++ bin/service/security.py 2016-07-18 14:07:23 +0000
@@ -54,6 +54,8 @@
54def login(db, login, password):54def login(db, login, password):
55 cr = pooler.get_db_only(db).cursor()55 cr = pooler.get_db_only(db).cursor()
56 nb = _get_number_modules(cr, testlogin=True)56 nb = _get_number_modules(cr, testlogin=True)
57 cr.execute("SELECT count(id) FROM patch_scripts WHERE run = \'f\'")
58 patch_failed = cr.fetchone()
57 to_update = False59 to_update = False
58 if not nb:60 if not nb:
59 to_update = updater.test_do_upgrade(cr)61 to_update = updater.test_do_upgrade(cr)
@@ -63,9 +65,16 @@
63 kwargs={'threaded': True})65 kwargs={'threaded': True})
64 s.start()66 s.start()
65 raise Exception("ServerUpdate: Server is updating modules ...")67 raise Exception("ServerUpdate: Server is updating modules ...")
68
69
66 pool = pooler.get_pool(db)70 pool = pooler.get_pool(db)
67 user_obj = pool.get('res.users')71 user_obj = pool.get('res.users')
68 return user_obj.login(db, login, password)72 user_res = user_obj.login(db, login, password)
73
74 if user_res != 1 and patch_failed[0]:
75 raise Exception("PatchFailed: A script during upgrade has failed. Login is forbidden. Please contact your administrator")
76
77 return user_res
6978
70def check_super(passwd):79def check_super(passwd):
71 if passwd == tools.config['admin_passwd']:80 if passwd == tools.config['admin_passwd']:

Subscribers

People subscribed via source and target branches

to all changes: