Example #1
0
    def test_create_individual(self):
        branch = self.create_branch()
        role = self.create_employee_role()

        editor = EmployeeEditor(self.store, role_type=Person.ROLE_INDIVIDUAL)
        self.check_editor(editor, 'editor-employee-individual-create-empty')

        individual_slave = editor._person_slave
        address_slave = editor._person_slave.address_slave
        employee_role_slave = editor.role_slave

        individual_slave.name.update('name foo')
        address_slave.street.update('street foo')
        address_slave.streetnumber.update(800)
        address_slave.district.update('district foo')
        employee_role_slave.role.update(role)
        employee_role_slave.salary.update(decimal.Decimal('50'))

        details_slave = editor.details_slave
        details_slave.branch_combo.update(branch)

        self.click(editor.main_dialog.ok_button)
        self.check_editor(editor,
                          'editor-employee-individual-create-confirmed',
                          [editor.retval, branch])
Example #2
0
    def test_update_status(self):
        employee = self.create_employee()
        sales_person = self.create_sales_person()
        employee.person.sales_person = sales_person
        sales_person.is_active = False
        editor = EmployeeEditor(self.store,
                                role_type=Person.ROLE_INDIVIDUAL,
                                model=employee)

        individual_slave = editor._person_slave
        address_slave = editor._person_slave.address_slave
        employee_role_slave = editor.role_slave

        individual_slave.name.update('name foo')
        address_slave.street.update('street foo')
        address_slave.streetnumber.update(800)
        address_slave.district.update('district foo')
        employee_role_slave.salary.update(decimal.Decimal('50'))

        editor.status_slave.statuses_combo.update(Employee.STATUS_NORMAL)
        self.click(editor.main_dialog.ok_button)
        self.assertTrue(sales_person.is_active)
Example #3
0
 def test_create_company(self):
     editor = EmployeeEditor(self.store, role_type=Person.ROLE_COMPANY)
     self.check_editor(editor, 'editor-employee-company-create')