'@case: HRM006
@description: Add a premade made staff to an Office
@TestDoc: https://docs.google.com/spreadsheet/ccc?key=0AmB3hMcgB-3idG1XNGhhRG9QWF81dUlKLXpJaFlCMFE
@Test Wiki: http://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Testing'

def test_hrm006_add_staff_to_office(self):

    browser = self.browser
    config = self.config
    self.login(account='admin', nexturl='org/office')
    self.dt_filter('AP    Zone')
    self.dt_action()
    url = browser.current_url
    url_parts = url.split('/')
    try:
        org_id = int(url_parts[(-2)])
    except:
        org_id = int(url_parts[(-1)])
    browser.get(('%s/org/office/%s/human_resource' % (config.url, org_id)))
    add_btn = self.browser.find_elements_by_id('show-add-btn')
    if (len(add_btn) > 0):
        add_btn[0].click()
    select_from_registry_btn = self.browser.find_element_by_id('select_from_registry')
    select_from_registry_btn.click()
    self.create('hrm_human_resource', [('person_id', 'Beatriz    de    Carvalho')])
