Demo entry 2841999

connector

   

Submitted by anonymous on Oct 10, 2015 at 01:03
Language: Groovy. Code size: 1.3 kB.

switch (objectClass) {
	case ObjectClass.ACCOUNT:
		def dataCollector = [ uid: ""]

		def handleCollectedData = {
			if (dataCollector.uid != "") {

				log.info("------------ id         ${dataCollector.id} ---");
				log.info("------------ uid        ${dataCollector.uid} ---");
				
				handler {
					uid dataCollector.id
					id dataCollector.uid
					attribute 'uid', dataCollector.uid
					attribute 'fullname', dataCollector.fullname
					attribute 'firstname', dataCollector.firstname
					attribute 'lastname', dataCollector.lastname
					attribute 'email', dataCollector.email
				}
			}
		}
		
		def odoo_ids = sock.execute(dbname, uid, pwd, 'res.users', 'search',[])
		def res = sock.execute(dbname, uid, pwd, 'res.users', 'read', odoo_ids,
								['id', 'login','name','email','password_crypt', 'company_id'])

		res.each { row ->
			if (dataCollector.uid != row.login) {
				log.info("--------------------------------- STEP 1 ---")
				handleCollectedData();
				log.info("--------------------------------- STEP 2 ---")
				dataCollector = [
						id : row.id as String,
						uid : row.login,
						fullname: row.name,
						firstname: row.name,
						lastname: row.name,
						email: row.email
				]
			}

			lastId = row.id
			resultCount++
		};

		handleCollectedData();

		break

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).