ufload3 2.1__tar.gz → 2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ufload3
3
- Version: 2.1
3
+ Version: 2.4
4
4
  Summary: UniField python3 loader
5
5
  Author: MSF
6
6
  Project-URL: Homepage, https://github.com/Unifield/ufload3
@@ -1,7 +1,7 @@
1
1
  from . import cloud; assert cloud
2
2
  from . import db; assert db
3
3
 
4
- __version__ = '2.1'
4
+ __version__ = '2.4'
5
5
 
6
6
  # null progress, can be overridden by importers
7
7
  def _progress(p):
@@ -494,9 +494,6 @@ def _cmdLs(args):
494
494
  ufload3.progress('Argument --cert-content or --cert-path is required for this sub-command.')
495
495
  return 2
496
496
 
497
- if args.cert_path:
498
- with open(args.cert_path, 'r') as c:
499
- args.cert_content = c.read()
500
497
 
501
498
 
502
499
  if args.subdir is None:
@@ -64,6 +64,10 @@ def get_cloud_info(args, sub_dir=''):
64
64
  except:
65
65
  #The argument cloudpath is not defined, forget about it (this is not the upgrade process)
66
66
  pass
67
+
68
+ if args.cert_path:
69
+ with open(args.cert_path, 'r') as c:
70
+ args.cert_content = c.read()
67
71
 
68
72
  ret = {
69
73
  'url': args.cloud_url,
@@ -94,7 +94,15 @@ def psql(args, sql, db='postgres', silent=False):
94
94
 
95
95
  def psql_file(args, file, db='postgres', silent=False):
96
96
  return _run(args, mkpsql_file(args, file, db), silent)
97
-
97
+
98
+ def _check_column_exists(args, table, column, db):
99
+ v = _run(args, mkpsql(args, """SELECT c.relname
100
+ FROM pg_class c, pg_attribute a
101
+ WHERE c.relname='%s' AND a.attname='%s' AND c.oid=a.attrelid;""" % (table, column), db), get_out=True)
102
+ if v and v[0] == 0:
103
+ return v[1].strip()
104
+ return False
105
+
98
106
  def load_zip_into(args, db, f, sz):
99
107
  if sz == 0:
100
108
  ufload3.progress("Note: No progress percent available.")
@@ -361,7 +369,7 @@ def instantiate(args, db):
361
369
  connection = transport.make_connection(host)
362
370
  connection.timeout = 4
363
371
  sock = xmlrpc.client.ServerProxy('http://%s:%s/xmlrpc/common' % (host, port), transport=transport)
364
- uid = sock.login(db, args.adminuser.lower(), args.adminpw)
372
+ sock.login(db, args.adminuser.lower(), args.adminpw)
365
373
  except Exception as e:
366
374
  ufload3.progress("non blocking error at first connection %s" % e)
367
375
 
@@ -391,6 +399,10 @@ def delive(args, db):
391
399
 
392
400
  rc = psql(args, 'alter table sync_client_sync_server_connection ADD COLUMN IF NOT EXISTS ufload_automatic_patching_prod_value boolean;', db)
393
401
  rc = psql(args, 'update sync_client_sync_server_connection set ufload_automatic_patching_prod_value=automatic_patching;', db)
402
+
403
+ rc = psql(args, 'alter table users_last_login ADD COLUMN IF NOT EXISTS date_prod_value timestamp without time zone;', db)
404
+ rc = psql(args, 'update users_last_login set date_prod_value=date;', db)
405
+
394
406
  rc = psql(args, 'update sync_client_sync_server_connection set automatic_patching = \'f\', protocol = \'xmlrpc\', login = \'%s\', database = \'%s\', host = \'127.0.0.1\', port = %d;' % (adminuser, ss, port), db)
395
407
  if rc != 0:
396
408
  return rc
@@ -414,14 +426,23 @@ def delive(args, db):
414
426
  if rc != 0:
415
427
  return rc
416
428
  # Automated import settings
417
- psql(args, 'UPDATE automated_import SET report_path=\'\', src_path=\'\', ftp_url=\'\', dest_path=\'\', ftp_ok=\'f\', ftp_port=\'\',dest_path_failure=\'\', ftp_login=\'\', ftp_password=\'\', ftp_protocol=\'\';', db)
429
+ psql(args, 'UPDATE automated_import SET active=\'f\', report_path=\'\', src_path=\'\', ftp_url=\'\', dest_path=\'\', ftp_ok=\'f\', ftp_port=\'\',dest_path_failure=\'\', ftp_login=\'\', ftp_password=\'\', ftp_protocol=\'\';', db)
430
+
431
+ if _check_column_exists(args, "automated_import", "sharepoint_cert", db):
432
+ psql(args, 'UPDATE automated_import SET sharepoint_cert=NULL;', db)
433
+
434
+ if _check_column_exists(args, "msf_instance", "cloud_cert_content", db):
435
+ psql(args, 'UPDATE msf_instance SET cloud_cert_content=NULL;', db)
436
+
437
+ if _check_column_exists(args, "automated_import", "email_notification_type", db):
438
+ psql(args, 'UPDATE automated_import set email=NULL, email2=NULL, email3=NULL;', db)
418
439
 
419
440
  # Automated export jobs
420
441
  rc = psql(args, 'update ir_cron set active = \'f\' where model = \'automated.export\';', db)
421
442
  if rc != 0:
422
443
  return rc
423
444
  # Automated export settings
424
- psql(args, 'UPDATE automated_export SET report_path=\'\', ftp_url=\'\', dest_path=\'\', ftp_ok=\'f\', ftp_port=\'\',dest_path_failure=\'\', ftp_login=\'\', ftp_password=\'\', ftp_protocol=\'\';', db)
445
+ psql(args, 'UPDATE automated_export SET active=\'f\', report_path=\'\', ftp_url=\'\', dest_path=\'\', ftp_ok=\'f\', ftp_port=\'\',dest_path_failure=\'\', ftp_login=\'\', ftp_password=\'\', ftp_protocol=\'\';', db)
425
446
 
426
447
  # Now we check for arguments allowing auto-sync and silent-upgrade
427
448
  if args.autosync:
@@ -498,8 +519,8 @@ def delive(args, db):
498
519
  if args.db_prefix:
499
520
  db_name = db_name.split(args.db_prefix+'_', 1)[1]
500
521
  new_pass_dict = []
501
- for pass_part in re.split( '(\[\d+\+\d+\])', args.newuserspw):
502
- m = re.search('\[(\d+)\+(\d+)\]', pass_part)
522
+ for pass_part in re.split(r'(\[\d+\+\d+\])', args.newuserspw):
523
+ m = re.search(r'\[(\d+)\+(\d+)\]', pass_part)
503
524
  if m:
504
525
  pos = int(m.group(1)) - 1
505
526
  add = int(m.group(2))
@@ -511,7 +532,17 @@ def delive(args, db):
511
532
 
512
533
  for new_user_info in args.createusers.split(';'):
513
534
  new_user_data = new_user_info.split(':')
514
- if len(new_user_data) == 3:
535
+ new_user_dpt = False
536
+ new_user_name = False
537
+ new_user_email = False
538
+ if len(new_user_data) == 6:
539
+ new_user = new_user_data[0]
540
+ new_user_name = new_user_data[1]
541
+ new_user_email = new_user_data[2]
542
+ new_user_dpt = new_user_data[3]
543
+ new_user_pass = new_user_data[4]
544
+ groups = new_user_data[5]
545
+ elif len(new_user_data) == 3:
515
546
  new_user= new_user_data[0]
516
547
  new_user_pass = new_user_data[1]
517
548
  groups = new_user_data[2]
@@ -519,12 +550,25 @@ def delive(args, db):
519
550
  new_user= new_user_data[0]
520
551
  new_user_pass = newpass
521
552
  groups = new_user_data[1]
553
+
554
+ if not new_user_name:
555
+ new_user_name = new_user
522
556
  rc, new_userid = psql(args, """ insert into res_users (name, active, login, password, context_lang, company_id, view, menu_id) values
523
557
  ('%s', 't', '%s', '%s', 'en_MF', 1, 'simple', 1) returning id;"""
524
- % (new_user, new_user.lower(), new_user_pass), db, silent=True)
558
+ % (new_user_name, new_user.lower(), new_user_pass), db, silent=True)
525
559
  if rc != 0:
526
560
  return rc
527
- for new_group in groups.split(','):
561
+ if new_user_dpt:
562
+ psql(args, """ update res_users u set context_department_id = d.id
563
+ from hr_department d
564
+ where d.name = '%s' and u.id = %s """ % (new_user_dpt, new_userid), db)
565
+
566
+ if new_user_email:
567
+ rc, address_id = psql(args, """ insert into res_partner_address (name, email) values ('%s', '%s') returning id """ % (new_user_name, new_user_email), db, silent=True)
568
+ if address_id:
569
+ psql(args,"update res_users set address_id=%s where id=%s" % (address_id, new_userid), db)
570
+
571
+ for new_group in groups.split(','):
528
572
  rc = psql(args, " insert into res_groups_users_rel (uid, gid) (select %s, id from res_groups where name='%s');" % (new_userid, new_group), db)
529
573
  if rc != 0:
530
574
  return rc
@@ -608,7 +652,7 @@ def get_hwid(args):
608
652
  import winreg
609
653
  try:
610
654
  with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
611
- "SYSTEM\ControlSet001\services\eventlog\Application\openerp-web-6.0",
655
+ r"SYSTEM\ControlSet001\services\eventlog\Application\openerp-web-6.0",
612
656
  0, winreg.KEY_READ) as registry_key:
613
657
  hwid, regtype = winreg.QueryValueEx(registry_key, "HardwareId")
614
658
  ufload3.progress("Hardware id from registry key: %s" % hwid)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ufload3
3
- Version: 2.1
3
+ Version: 2.4
4
4
  Summary: UniField python3 loader
5
5
  Author: MSF
6
6
  Project-URL: Homepage, https://github.com/Unifield/ufload3
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes