[POS-commit] r1879 - in stoq/trunk/stoq: domain examples gui/editors gui/slaves gui/slaves/glade gui/templates gui/templates/glade lib tests

Bruno Rafael Garcia brg at async.com.br
Wed Dec 14 12:22:41 BRST 2005


Author: brg
Date: Wed Dec 14 12:22:37 2005
New Revision: 1879

Added:
   stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleHistorySlave.glade
   stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleSlave.glade
Modified:
   stoq/trunk/stoq/domain/person.py
   stoq/trunk/stoq/domain/tables.py
   stoq/trunk/stoq/examples/person.py
   stoq/trunk/stoq/gui/editors/person.py
   stoq/trunk/stoq/gui/slaves/employee.py
   stoq/trunk/stoq/gui/slaves/glade/EmployeeDetailsSlave.glade
   stoq/trunk/stoq/gui/templates/glade/PersonEditorTemplate.glade
   stoq/trunk/stoq/gui/templates/person.py
   stoq/trunk/stoq/lib/parameters.py
   stoq/trunk/stoq/tests/test_parameters.py
Log:
fix for bug 2113: Employee editor modified.

Role treatment together the employee editor reformulated and added a new tab
with a history of the employee roles.

r=evandro


Modified: stoq/trunk/stoq/domain/person.py
==============================================================================
--- stoq/trunk/stoq/domain/person.py	(original)
+++ stoq/trunk/stoq/domain/person.py	Wed Dec 14 12:22:37 2005
@@ -24,6 +24,7 @@
 ##              Henrique Romano             <henrique at async.com.br>
 ##              Daniel Saran R. da Cunha    <daniel at async.com.br>
 ##              Ariqueli Tejada Fonseca     <aritf at async.com.br>
+##              Bruno Rafael Garcia         <brg at async.com.br>
 ##
 """
 stoq/domain/person.py:
@@ -41,7 +42,6 @@
 from zope.interface import implements
 
 from stoq.lib.validators import raw_phone_number
-from stoq.lib.runtime import get_connection
 from stoq.domain.base import CannotAdapt, Domain, ModelAdapter
 from stoq.domain.interfaces import (IIndividual, ICompany, IEmployee,
                                     IClient, ISupplier, IUser, IBranch,
@@ -61,18 +61,6 @@
     
     name = StringCol(alternateID=True)
 
-    #
-    # SQLObject callbacks
-    #
-
-    def _set_name(self, value):
-        conn = get_connection()
-        query = EmployeeRole.q.name == value
-        # FIXME We should raise a proper stoqlib exception here if we find
-        # an existing role. Waiting for kiwi support
-        if not EmployeeRole.select(query, connection=conn).count():
-            self._SO_set_name(value)
-
 
 # WorkPermitData, MilitaryData, and VoterData are Brazil-specific information.
 class WorkPermitData(Domain):
@@ -491,6 +479,19 @@
     voter_data = ForeignKey('VoterData', default=None)
     bank_account = ForeignKey('BankAccount', default=None)
 
+    def get_role_history(self):
+        conn = self.get_connection()
+        return EmployeeRoleHistory.selectBy(employee=self, connection=conn)
+
+    def get_active_role_history(self):
+        active = [history for history in self.get_role_history()
+                    if history.is_active]
+        qty = len(active)
+        if qty != 1:
+            raise DatabaseInconsistency('You should have only one active '
+                                        'role history, got %d' % qty)
+        return active[0]
+
     def get_status_string(self):
         if not self.statuses.has_key(self.status):
             raise DatabaseInconsistency('Invalid status for employee, '
@@ -693,8 +694,19 @@
      COMMISSION_BY_SELLABLE_CATEGORY, 
      COMMISSION_BY_SALE_TOTAL) = range(7)
 
-    commission = FloatCol(default=0.0)
-    commission_type = IntCol(default=COMMISSION_BY_SALESPERSON)
+    comission_types = {COMMISSION_GLOBAL: _('Globally'),
+                       COMMISSION_BY_SALESPERSON: _('By Salesperson'),
+                       COMMISSION_BY_SELLABLE: _('By Sellable'),
+                       COMMISSION_BY_PAYMENT_METHOD: _('By Payment Method'),
+                       COMMISSION_BY_BASE_SELLABLE_CATEGORY: _('By Base '
+                                                              'Sellable '
+                                                              'Category'),
+                       COMMISSION_BY_SELLABLE_CATEGORY: _('By Sellable '
+                                                         'Category'),
+                       COMMISSION_BY_SALE_TOTAL: _('By Sale Total')}
+
+    comission = FloatCol(default=0.0)
+    comission_type = IntCol(default=COMMISSION_BY_SALESPERSON)
     is_active = BoolCol(default=True)
 
     #
@@ -775,3 +787,13 @@
     current_password = None
     new_password = None
     confirm_password = None
+
+class EmployeeRoleHistory(Domain):
+    """Base class to store the employee role history."""
+
+    began = DateTimeCol(default=datetime.datetime.now())
+    ended = DateTimeCol(default=None)
+    salary = FloatCol()
+    role = ForeignKey('EmployeeRole')
+    employee = ForeignKey('PersonAdaptToEmployee')
+    is_active = BoolCol(default=True)

Modified: stoq/trunk/stoq/domain/tables.py
==============================================================================
--- stoq/trunk/stoq/domain/tables.py	(original)
+++ stoq/trunk/stoq/domain/tables.py	Wed Dec 14 12:22:37 2005
@@ -80,6 +80,7 @@
                                             "PersonAdaptToBankBranch",
                                             "PersonAdaptToCreditProvider",
                                             "PersonAdaptToTransporter",
+                                            "EmployeeRoleHistory",
                                             )),
      ('stoq.domain.till',                  ("Till",
                                             "TillAdaptToPaymentGroup",

Modified: stoq/trunk/stoq/examples/person.py
==============================================================================
--- stoq/trunk/stoq/examples/person.py	(original)
+++ stoq/trunk/stoq/examples/person.py	Wed Dec 14 12:22:37 2005
@@ -31,19 +31,23 @@
 """
 
 import datetime
+import gettext
 
 from stoq.lib.runtime import new_transaction, print_msg
 from stoq.domain.profile import UserProfile
 from stoq.domain.person import (Person, EmployeeRole, Address,
-                                CityLocation)
+                                CityLocation, EmployeeRoleHistory)
 from stoq.domain.interfaces import (ICompany, ISupplier, IBranch, 
                                     IClient, IIndividual, 
                                     IEmployee, ISalesPerson,
                                     IUser, ICreditProvider, ITransporter)
 
+_ = gettext.gettext
+
+
 def create_persons():
     print_msg('Creating persons...', break_line=False)
-    trans = new_transaction()
+    conn = new_transaction()
 
     person_data = [dict(name='John Wayne', 
                         phone_number='5143-2587',
@@ -84,10 +88,10 @@
                          fancy_name='Dog Ltd',
                          state_registry='3421')]
 
-    position_data = [dict(name='SalesPerson'),
-                     dict(name='Manager'),
-                     dict(name='Secretary'), 
-                     dict(name='Director')]
+    role_data = [dict(name=_('Clerk')),
+                 dict(name=_('Manager')),
+                 dict(name=_('Secretary')), 
+                 dict(name=_('Director'))]
 
     employee_data = [dict(registry_number='00099'), 
                      dict(registry_number='7777'),
@@ -138,55 +142,75 @@
                             dict(short_name='Fininvest', 
                                  provider_type=finance_type)]
 
+    role_history_data = [dict(began=now, salary=100,
+                              ended=now + datetime.timedelta(5)),
+                         dict(began=now + datetime.timedelta(5), salary=200,
+                              ended=now + datetime.timedelta(10)),
+                         dict(began=now + datetime.timedelta(10), salary=300,
+                              ended=now + datetime.timedelta(15)),
+                         dict(began=now + datetime.timedelta(15), salary=400,
+                              ended=now + datetime.timedelta(20))]
+
     profile_names = ['Salesperson', 'Manager', 'Secretary', 'Trainee']
 
     # Creating persons and facets
     for index, person_args in enumerate(person_data):
-        person_obj = Person(connection=trans, **person_args)
+        person_obj = Person(connection=conn, **person_args)
 
-        ctloc = CityLocation(connection=trans, **cityloc_data[index])
+        ctloc = CityLocation(connection=conn, **cityloc_data[index])
         address = Address(is_main_address=True, 
                           person=person_obj, city_location=ctloc, 
-                          connection=trans, **address_data[index])
+                          connection=conn, **address_data[index])
         
         individual_args = individual_data[index]
-        person_obj.addFacet(IIndividual, connection=trans, 
+        person_obj.addFacet(IIndividual, connection=conn, 
                             **individual_args)
 
         company_args = company_data[index]
-        person_obj.addFacet(ICompany, connection=trans, 
+        person_obj.addFacet(ICompany, connection=conn, 
                             **company_args)
 
-        person_obj.addFacet(IClient, connection=trans)
-        person_obj.addFacet(ISupplier, connection=trans)
-        person_obj.addFacet(IBranch, connection=trans)
+        person_obj.addFacet(IClient, connection=conn)
+        person_obj.addFacet(ISupplier, connection=conn)
+        person_obj.addFacet(IBranch, connection=conn)
 
         credit_provider = credit_provider_data[index]
-        person_obj.addFacet(ICreditProvider, connection=trans,
+        person_obj.addFacet(ICreditProvider, connection=conn,
                             open_contract_date=datetime.datetime.today(),
                             **credit_provider)
 
-        position_args = position_data[index]
-        role = EmployeeRole(connection=trans, **position_args)
+        role_args = role_data[index]
+        role = EmployeeRole(connection=conn, **role_args)
         employee_args = employee_data[index]
-        person_obj.addFacet(IEmployee, connection=trans, role=role,
-                            **employee_args)
+        employee = person_obj.addFacet(IEmployee, connection=conn, 
+                                       role=role, **employee_args)
+        for history in role_history_data:
+            role_history = EmployeeRoleHistory(connection=conn, role=role,
+                                               employee=employee,
+                                               is_active=False,
+                                               **history)
+        began = now + datetime.timedelta(20)
+        role_history = EmployeeRoleHistory(connection=conn, role=role,
+                                           employee=employee,
+                                           is_active=True, salary=500, 
+                                           began=began)
+        employee.salary = role_history.salary
         # SalesPerson facet requires an employee facet.
-        person_obj.addFacet(ISalesPerson, connection=trans)
+        person_obj.addFacet(ISalesPerson, connection=conn)
 
         prof_name = profile_names[index]
         # The True argument here means full permition for this profile. 
         # This is useful when testing all the fetuares of Stoq applications
-        profile = UserProfile.create_profile_template(trans, prof_name, 
+        profile = UserProfile.create_profile_template(conn, prof_name, 
                                                       True)
         user_args = user_data[index]
-        person_obj.addFacet(IUser, connection=trans, profile=profile,
+        person_obj.addFacet(IUser, connection=conn, profile=profile,
                             **user_args)
         transporter_args = transporter_data[index]
-        person_obj.addFacet(ITransporter, connection=trans,
+        person_obj.addFacet(ITransporter, connection=conn,
                             **transporter_args)
         
-    trans.commit()
+    conn.commit()
     print_msg('done.')
 
 

Modified: stoq/trunk/stoq/gui/editors/person.py
==============================================================================
--- stoq/trunk/stoq/gui/editors/person.py	(original)
+++ stoq/trunk/stoq/gui/editors/person.py	Wed Dec 14 12:22:37 2005
@@ -35,23 +35,26 @@
 
 import gtk
 import gettext
-from sqlobject.sqlbuilder import func
+from sqlobject.sqlbuilder import func, AND
 from kiwi.datatypes import ValidationError
 from stoqlib.gui.editors import SimpleEntryEditor, BaseEditor
 
-from stoq.lib.runtime import new_transaction
+from stoq.lib.runtime import get_connection
 from stoq.gui.templates.person import BasePersonRoleEditor
 from stoq.gui.slaves.client import ClientStatusSlave
 from stoq.gui.slaves.credprovider import CreditProviderDetailsSlave
 from stoq.gui.slaves.employee import (EmployeeDetailsSlave,
-                                      EmployeeStatusSlave)
+                                      EmployeeStatusSlave, 
+                                      EmployeeRoleSlave, 
+                                      EmployeeRoleHistorySlave)
 from stoq.gui.slaves.user import (UserDetailsSlave, UserStatusSlave,
                                   PasswordEditorSlave)
 from stoq.gui.slaves.supplier import SupplierDetailsSlave
 from stoq.gui.slaves.transporter import TransporterDataSlave
 from stoq.domain.person import EmployeeRole, LoginInfo
 from stoq.domain.interfaces import (IClient, ICreditProvider, IEmployee,
-                                    ISupplier, ITransporter, IUser)
+                                    ISupplier, ITransporter, IUser, 
+                                    ICompany, IIndividual)
 
 _ = gettext.gettext
 
@@ -210,6 +213,8 @@
 
     def create_model(self, conn):
         person = BasePersonRoleEditor.create_model(self, conn)
+        if ICompany(person, connection=self.conn):
+            person.addFacet(IIndividual, connection=self.conn)
         employee = IEmployee(person, connection=conn)
         return employee or person.addFacet(IEmployee, connection=conn,
                                            role=None)
@@ -219,13 +224,26 @@
         if not self.individual_slave:
             raise ValueError('This editor must have an individual slave')
         self.details_slave = EmployeeDetailsSlave(self.conn, self.model)
-        tab_text = _('Employee Data')
+        custom_tab_label = _('Employee Data')
         slave = self.individual_slave
         slave._person_slave.attach_custom_slave(self.details_slave,
-                                                tab_text)
+                                                custom_tab_label)
         self.status_slave = EmployeeStatusSlave(self.conn, self.model)
         slave.attach_person_slave(self.status_slave)
+        self.role_slave = EmployeeRoleSlave(self.conn, self.model,
+                                            edit_mode=self.edit_mode)
+        slave._person_slave.attach_role_slave(self.role_slave)
+        history_tab_label = _("Role History")
+        history_slave = EmployeeRoleHistorySlave(self.model)
+        slave._person_slave.attach_extra_slave(history_slave,
+                                               history_tab_label)
 
+    def on_confirm(self):
+        self.individual_slave.on_confirm()
+        self.role_slave.on_confirm()
+        return self.model
+                
+ 
 
 class EmployeeRoleEditor(SimpleEntryEditor):
     model_type = EmployeeRole
@@ -235,7 +253,6 @@
     def __init__(self, conn, model):
         SimpleEntryEditor.__init__(self, conn, model, attr_name='name',
                                    name_entry_label='Role Name:')
-        self.main_dialog.enable_notices()
 
     #
     # BaseEditor Hooks
@@ -251,29 +268,23 @@
     def create_model(self, conn):
         return EmployeeRole(connection=conn, name='')
 
-    #     
-    # BasicPluggableDialog Hooks
-    #         
-
-    def after_name_entry__changed(self, *args):
-        self.main_dialog.clear_notices()
-        role_name = self.name_entry.get_text()
-        conn = new_transaction() 
-        self.main_dialog.enable_ok()
-        for role in EmployeeRole.select(connection=conn):
-            query = func.UPPER(EmployeeRole.q.name) == role_name.upper()
-            if EmployeeRole.select(query, connection=conn).count():       
-                msg = _('This role already exists!')
-                # FIXME enable this line after a bug fix in kiwi
-                # self.name_entry.set_invalid(msg)
-                self.main_dialog.disable_ok()
-                # XXX We will not need this line when kiwi provide 
-                # support for validation when changing the model 
-                # attribute dynamically
-                self.main_dialog.alert(msg)
-                return False
-        self.model.name = role_name
-        return self.model
+    def on_cancel(self):
+        # XXX This will prevent problems in case that you can't
+        # update the connection.
+        if not self.edit_mode:
+            self.model_type.delete(self.model.id, connection=self.conn)
+
+    #
+    # Kiwi handlers
+    #
+
+    def on_name_entry__validate(self, widget, value):
+        conn = get_connection()
+        q1 = func.UPPER(EmployeeRole.q.name) == value.upper()
+        q2 = EmployeeRole.q.id != self.model.id
+        query = AND(q1, q2)
+        if EmployeeRole.select(query, connection=conn).count():       
+            return ValidationError('This role already exists!')
 
 
 class SupplierEditor(BasePersonRoleEditor):

Modified: stoq/trunk/stoq/gui/slaves/employee.py
==============================================================================
--- stoq/trunk/stoq/gui/slaves/employee.py	(original)
+++ stoq/trunk/stoq/gui/slaves/employee.py	Wed Dec 14 12:22:37 2005
@@ -23,6 +23,7 @@
 ##  Author(s):      Daniel Saran R. da Cunha    <daniel at async.com.br>
 ##                  Henrique Romano             <henrique at async.com.br>
 ##                  Evandro Vale Miquelito      <evandro at async.com.br>
+##                  Bruno Rafael Garcia         <brg at async.com.br>
 ##
 """
 /stoq/gui/slaves/employee.py
@@ -30,15 +31,27 @@
     Employee editor slaves implementation.
 """
 
+import datetime
+import gettext
 
 import gtk
+from kiwi.datatypes import currency
+from kiwi.ui.delegates import SlaveDelegate
+from kiwi.ui.widgets.list import Column
+from kiwi.datatypes import ValidationError
 from stoqlib.gui.editors import BaseEditorSlave
+from stoqlib.gui.dialogs import run_dialog
+from stoqlib.gui.search import get_max_search_results
 
-from stoq.domain.person import (WorkPermitData, MilitaryData, 
-                                VoterData, EmployeeRole)
-from stoq.domain.interfaces import IEmployee
+from stoq.lib.parameters import sysparam
+from stoq.lib.validators import get_price_format_str, get_formatted_price
+from stoq.domain.person import (Person, WorkPermitData, MilitaryData, 
+                                VoterData, EmployeeRole, EmployeeRoleHistory)
+from stoq.domain.interfaces import IEmployee, ISalesPerson
 from stoq.domain.account import BankAccount
 
+_ = gettext.gettext
+
 
 class EmployeeDetailsSlave(BaseEditorSlave):
     gladefile = 'EmployeeDetailsSlave'
@@ -50,15 +63,13 @@
 
     left_widgets_group =  ('admission_date_label',
                            'registry_number_label',
-                           'role_label',
                            'military_cert_serie_label',
                            'military_cert_category_label',
                            'military_cert_number_label',
                            'voter_id_number_label',
                            'voter_id_zone_label',
                            'voter_id_section_label',
-                           'expire_vacation_label',
-                           'salary_label')
+                           'expire_vacation_label')
 
     right_widgets_group = ('person_dependent_number_label',
                            'education_level_label',
@@ -78,10 +89,8 @@
     employee_widgets =    ('admission_date',
                            'registry_number',
                            'expire_vacation',
-                           'salary',
                            'dependent_person_number',
-                           'education_level',
-                           'role')
+                           'education_level')
 
     bank_account_widgets = ('name',
                             'account',
@@ -117,21 +126,12 @@
             w = getattr(self, widget)
             self.right_size_group.add_widget(w)
 
-        self.salary.set_data_format('%.2f')
-
-    def setup_combos(self):
-        roles = EmployeeRole.select(connection=self.conn)
-        items = [(role.name, role) for role in roles]
-
-        self.role.prefill(items)
-
     #
     # BaseEditorSlave hooks
     # 
 
     def setup_proxies(self):
         self.setup_widgets()
-        self.setup_combos()
 
         assert(self.model)
 
@@ -168,4 +168,144 @@
         self.proxy = self.add_proxy(self.model,
                                     EmployeeStatusSlave.widgets)
 
+class EmployeeRoleSlave(BaseEditorSlave):
+    gladefile = 'EmployeeRoleSlave'
+    model_type = EmployeeRoleHistory
+    proxy_widgets = ('role',
+                     'salary',)
+
+    def __init__(self, conn, employee, edit_mode):
+        self.max_results = get_max_search_results()
+        self.employee = employee
+        self.person = employee.get_adapted()
+        self.salesperson = ISalesPerson(self.person, connection=conn)
+        self.is_edit_mode = edit_mode
+        self.current_role_history = self._get_active_role_history()
+        BaseEditorSlave.__init__(self, conn)
+ 
+    def _setup_entry_completion(self):
+        roles = [role for role in
+                 EmployeeRole.select(connection=self.conn)]
+        roles = roles[:self.max_results]
+        strings = [role.name for role in roles]
+        self.role.set_completion_strings(strings, list(roles))
+
+    def _setup_widgets(self):
+        if self.salesperson:
+            self.comission.update(self.salesperson.comission)
+        self._setup_entry_completion()
+        self.salary.set_data_format(get_price_format_str())
+
+    def _get_active_role_history(self):
+        if self.is_edit_mode:
+            return self.employee.get_active_role_history()
+        else:
+            return None
+
+    def _is_default_salesperson_role(self):
+        if (sysparam(self.conn).DEFAULT_SALESPERSON_ROLE == 
+            self.model.role):
+            return True
+        return False
+
+    def on_confirm(self):
+        if self._is_default_salesperson_role():
+            if self.salesperson:
+                if not self.salesperson.is_active: 
+                    self.salesperson.activate()
+            else:
+                conn = self.conn
+                self.salesperson = self.person.addFacet(ISalesPerson, 
+                                                        connection=conn)
+            self.salesperson.comission = self.comission.get_value()
+        elif self.salesperson:
+            if self.salesperson.is_active:
+                self.salesperson.inactivate()
+        
+        self.employee.salary = self.model.salary
+        if not self.model.role == self.employee.role:
+            self.employee.role = self.model.role
+            if self.current_role_history:
+                self.current_role_history.salary = self.model.salary
+                self.current_role_history.ended = datetime.datetime.now()
+                self.current_role_history.is_active = False
+        else:
+            # XXX This will prevent problems in case that you can't update 
+            # the connection.
+            self.model_type.delete(self.model.id, connection=self.conn)
+        return self.model
+
+    #
+    # BaseEditorSlave Hooks
+    #
     
+    def create_model(self, conn):
+        return EmployeeRoleHistory(connection=conn,
+                                   salary=self.employee.salary,
+                                   role=self.employee.role, 
+                                   employee=self.employee)
+
+    def setup_proxies(self):
+        self._setup_widgets()
+        self.proxy = self.add_proxy(self.model,
+                                    EmployeeRoleSlave.proxy_widgets)
+        self._update_sensitivity()
+        if not self.is_edit_mode:
+            self.salary.set_text("")
+
+    #
+    # Kiwi handlers
+    #
+
+    def on_role_editor_button__clicked(self, *args):
+        # This will avoid the circular import
+        from stoq.gui.editors.person import EmployeeRoleEditor
+        model =  run_dialog(EmployeeRoleEditor, self, self.conn,
+                            self.model.role)
+        if model:
+            self._setup_entry_completion()
+            self.proxy.update('role')
+
+    def on_salary__validate(self, widget, value):
+        if value <= 0:
+            return ValidationError("Salary must be greater than zero")
+
+    def after_role__changed(self, widget):
+        self._update_sensitivity()
+        
+    def _update_sensitivity(self):
+        editor = True
+        settings = False
+        if self.role.get_text():
+            editor = self.role.is_valid()
+            if editor:
+                settings = self._is_default_salesperson_role()
+        else:
+            self.model.role = None
+        self.role_editor_button.set_sensitive(editor)
+        self.comission.set_sensitive(settings)
+
+
+class EmployeeRoleHistorySlave(SlaveDelegate):
+    gladefile = "EmployeeRoleHistorySlave"
+
+    def __init__(self, employee):
+        self.employee = employee
+        SlaveDelegate.__init__(self, gladefile=self.gladefile)
+        self._setup_widgets()
+
+    def _setup_widgets(self):
+        self.history_list.set_columns(self._get_columns())
+        self.history_list.add_list(self._get_objects())
+
+    def _get_objects(self):
+        return [result for result in self.employee.get_role_history() 
+                if not result.is_active]
+                    
+    def _get_columns(self):
+        return [Column('began', _('Began'), data_type=datetime.date,
+                       width=100),
+                Column('ended', _('Ended'), data_type=datetime.date,
+                       width=100, sorted=True),
+                Column('role.name', _('Role'), data_type=str, width=200),
+                Column('salary', _('Salary'), data_type=currency)]

Modified: stoq/trunk/stoq/gui/slaves/glade/EmployeeDetailsSlave.glade
==============================================================================
--- stoq/trunk/stoq/gui/slaves/glade/EmployeeDetailsSlave.glade	(original)
+++ stoq/trunk/stoq/gui/slaves/glade/EmployeeDetailsSlave.glade	Wed Dec 14 12:22:37 2005
@@ -2,12 +2,12 @@
 <!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd">
 <glade-interface>
     <widget class="GtkWindow" id="EmployeeDetailsSlave">
-        <property name="role"></property>
-        <property name="title" context="yes" translatable="yes"></property>
+        <property name="default_height">250</property>
+        <property name="default_width">440</property>
         <child>
-            <widget class="GtkTable" id="table8">
+            <widget class="GtkTable" id="table1">
                 <property name="n_columns">2</property>
-                <property name="n_rows">3</property>
+                <property name="n_rows">4</property>
                 <property name="visible">True</property>
                 <child>
                     <widget class="GtkFrame" id="frame6">
@@ -19,7 +19,7 @@
                                 <property name="border_width">5</property>
                                 <property name="column_spacing">5</property>
                                 <property name="n_columns">2</property>
-                                <property name="n_rows">5</property>
+                                <property name="n_rows">3</property>
                                 <property name="row_spacing">5</property>
                                 <property name="visible">True</property>
                                 <child>
@@ -29,8 +29,7 @@
                                         <property name="xalign">1.0</property>
                                     </widget>
                                     <packing>
-                                        <property name="x_options">fill</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -42,34 +41,7 @@
                                     <packing>
                                         <property name="bottom_attach">2</property>
                                         <property name="top_attach">1</property>
-                                        <property name="x_options">fill</property>
-                                        <property name="y_options">expand</property>
-                                    </packing>
-                                </child>
-                                <child>
-                                    <widget class="GtkLabel" id="role_label">
-                                        <property name="label" context="yes" translatable="yes">Role:</property>
-                                        <property name="visible">True</property>
-                                        <property name="xalign">1.0</property>
-                                    </widget>
-                                    <packing>
-                                        <property name="bottom_attach">3</property>
-                                        <property name="top_attach">2</property>
-                                        <property name="x_options">fill</property>
-                                        <property name="y_options">expand</property>
-                                    </packing>
-                                </child>
-                                <child>
-                                    <widget class="GtkLabel" id="salary_label">
-                                        <property name="label" context="yes" translatable="yes">Salary:</property>
-                                        <property name="visible">True</property>
-                                        <property name="xalign">1.0</property>
-                                    </widget>
-                                    <packing>
-                                        <property name="bottom_attach">4</property>
-                                        <property name="top_attach">3</property>
-                                        <property name="x_options">fill</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -79,25 +51,27 @@
                                         <property name="xalign">1.0</property>
                                     </widget>
                                     <packing>
-                                        <property name="bottom_attach">5</property>
-                                        <property name="top_attach">4</property>
-                                        <property name="x_options">fill</property>
+                                        <property name="bottom_attach">3</property>
+                                        <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="admission_date">
                                         <property name="data_type">date</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">admission_date</property>
                                     </widget>
                                     <packing>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="registry_number">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">registry_number</property>
                                     </widget>
                                     <packing>
@@ -105,52 +79,94 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">1</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
-                                    <widget class="kiwi+ui+widgets+combobox+ComboBox" id="role">
-                                        <property name="data_type">object</property>
-                                        <property name="model_attribute">role</property>
+                                    <widget class="kiwi+ui+widgets+entry+Entry" id="expire_vacation">
+                                        <property name="data_type">date</property>
+                                        <property name="is_focus">True</property>
+                                        <property name="model_attribute">expire_vacation</property>
                                     </widget>
                                     <packing>
                                         <property name="bottom_attach">3</property>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">2</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
+                            </widget>
+                        </child>
+                    </widget>
+                </child>
+                <child>
+                    <widget class="GtkFrame" id="frame1">
+                        <property name="border_width">2</property>
+                        <property name="label" context="yes" translatable="yes">Work Permit</property>
+                        <property name="visible">True</property>
+                        <child>
+                            <widget class="GtkTable" id="table2">
+                                <property name="border_width">5</property>
+                                <property name="column_spacing">5</property>
+                                <property name="n_columns">2</property>
+                                <property name="n_rows">2</property>
+                                <property name="row_spacing">5</property>
+                                <property name="visible">True</property>
                                 <child>
-                                    <widget class="kiwi+ui+widgets+entry+Entry" id="salary">
-                                        <property name="data_type">float</property>
-                                        <property name="model_attribute">salary</property>
+                                    <widget class="GtkLabel" id="workpermit_number_label">
+                                        <property name="label" context="yes" translatable="yes">Number:</property>
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1.0</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <widget class="GtkLabel" id="workpermit_serie_label">
+                                        <property name="label" context="yes" translatable="yes">Serie:</property>
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1.0</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="bottom_attach">2</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <widget class="kiwi+ui+widgets+entry+Entry" id="workpermit_number">
+                                        <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
+                                        <property name="model_attribute">number</property>
                                     </widget>
                                     <packing>
-                                        <property name="bottom_attach">4</property>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
-                                        <property name="top_attach">3</property>
-                                        <property name="y_options">expand</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
-                                    <widget class="kiwi+ui+widgets+entry+Entry" id="expire_vacation">
-                                        <property name="data_type">date</property>
-                                        <property name="model_attribute">expire_vacation</property>
+                                    <widget class="kiwi+ui+widgets+entry+Entry" id="workpermit_serie">
+                                        <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
+                                        <property name="model_attribute">series_number</property>
                                     </widget>
                                     <packing>
-                                        <property name="bottom_attach">5</property>
+                                        <property name="bottom_attach">2</property>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
-                                        <property name="top_attach">4</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                             </widget>
                         </child>
                     </widget>
                     <packing>
-                        <property name="y_options">expand | fill | shrink</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="top_attach">1</property>
                     </packing>
                 </child>
                 <child>
@@ -172,6 +188,9 @@
                                         <property name="visible">True</property>
                                         <property name="xalign">1.0</property>
                                     </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
                                 </child>
                                 <child>
                                     <widget class="GtkLabel" id="military_cert_serie_label">
@@ -182,6 +201,7 @@
                                     <packing>
                                         <property name="bottom_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -193,21 +213,25 @@
                                     <packing>
                                         <property name="bottom_attach">3</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="military_doc_number">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">number</property>
                                     </widget>
                                     <packing>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="military_doc_serie">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">series_number</property>
                                     </widget>
                                     <packing>
@@ -215,11 +239,13 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="military_doc_category">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">category</property>
                                     </widget>
                                     <packing>
@@ -227,15 +253,15 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                             </widget>
                         </child>
                     </widget>
                     <packing>
-                        <property name="bottom_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="y_options">expand | fill | shrink</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="top_attach">2</property>
                     </packing>
                 </child>
                 <child>
@@ -257,6 +283,9 @@
                                         <property name="visible">True</property>
                                         <property name="xalign">1.0</property>
                                     </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
                                 </child>
                                 <child>
                                     <widget class="GtkLabel" id="voter_id_section_label">
@@ -267,6 +296,7 @@
                                     <packing>
                                         <property name="bottom_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -278,21 +308,25 @@
                                     <packing>
                                         <property name="bottom_attach">3</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="voter_id_number">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">number</property>
                                     </widget>
                                     <packing>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="voter_id_section">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">section</property>
                                     </widget>
                                     <packing>
@@ -300,11 +334,13 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="voter_id_zone">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">zone</property>
                                     </widget>
                                     <packing>
@@ -312,149 +348,15 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                             </widget>
                         </child>
                     </widget>
                     <packing>
-                        <property name="bottom_attach">3</property>
-                        <property name="top_attach">2</property>
-                        <property name="y_options">expand | fill | shrink</property>
-                    </packing>
-                </child>
-                <child>
-                    <widget class="GtkVBox" id="vbox1">
-                        <property name="visible">True</property>
-                        <child>
-                            <widget class="GtkFrame" id="frame7">
-                                <property name="border_width">2</property>
-                                <property name="label" context="yes" translatable="yes">Personal Details</property>
-                                <property name="visible">True</property>
-                                <child>
-                                    <widget class="GtkTable" id="table1">
-                                        <property name="border_width">5</property>
-                                        <property name="column_spacing">5</property>
-                                        <property name="n_columns">2</property>
-                                        <property name="n_rows">2</property>
-                                        <property name="row_spacing">5</property>
-                                        <property name="visible">True</property>
-                                        <child>
-                                            <widget class="GtkLabel" id="education_level_label">
-                                                <property name="justify">right</property>
-                                                <property name="label" context="yes" translatable="yes">Education 
-Level:</property>
-                                                <property name="visible">True</property>
-                                                <property name="xalign">1.0</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="x_options">fill</property>
-                                            </packing>
-                                        </child>
-                                        <child>
-                                            <widget class="GtkLabel" id="person_dependent_number_label">
-                                                <property name="justify">right</property>
-                                                <property name="label" context="yes" translatable="yes">Dependent 
-Number:</property>
-                                                <property name="visible">True</property>
-                                                <property name="xalign">1.0</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="bottom_attach">2</property>
-                                                <property name="top_attach">1</property>
-                                                <property name="x_options">fill</property>
-                                            </packing>
-                                        </child>
-                                        <child>
-                                            <widget class="kiwi+ui+widgets+entry+Entry" id="education_level">
-                                                <property name="data_type">str</property>
-                                                <property name="model_attribute">education_level</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="left_attach">1</property>
-                                                <property name="right_attach">2</property>
-                                            </packing>
-                                        </child>
-                                        <child>
-                                            <widget class="kiwi+ui+widgets+entry+Entry" id="dependent_person_number">
-                                                <property name="data_type">int</property>
-                                                <property name="model_attribute">dependent_person_number</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="bottom_attach">2</property>
-                                                <property name="left_attach">1</property>
-                                                <property name="right_attach">2</property>
-                                                <property name="top_attach">1</property>
-                                            </packing>
-                                        </child>
-                                    </widget>
-                                </child>
-                            </widget>
-                        </child>
-                        <child>
-                            <widget class="GtkFrame" id="frame1">
-                                <property name="border_width">2</property>
-                                <property name="label" context="yes" translatable="yes">Work Permit</property>
-                                <property name="visible">True</property>
-                                <child>
-                                    <widget class="GtkTable" id="table2">
-                                        <property name="border_width">5</property>
-                                        <property name="column_spacing">5</property>
-                                        <property name="n_columns">2</property>
-                                        <property name="n_rows">2</property>
-                                        <property name="row_spacing">5</property>
-                                        <property name="visible">True</property>
-                                        <child>
-                                            <widget class="GtkLabel" id="workpermit_number_label">
-                                                <property name="label" context="yes" translatable="yes">Number:</property>
-                                                <property name="visible">True</property>
-                                                <property name="xalign">1.0</property>
-                                            </widget>
-                                        </child>
-                                        <child>
-                                            <widget class="GtkLabel" id="workpermit_serie_label">
-                                                <property name="label" context="yes" translatable="yes">Serie:</property>
-                                                <property name="visible">True</property>
-                                                <property name="xalign">1.0</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="bottom_attach">2</property>
-                                                <property name="top_attach">1</property>
-                                            </packing>
-                                        </child>
-                                        <child>
-                                            <widget class="kiwi+ui+widgets+entry+Entry" id="workpermit_number">
-                                                <property name="data_type">str</property>
-                                                <property name="model_attribute">number</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="left_attach">1</property>
-                                                <property name="right_attach">2</property>
-                                            </packing>
-                                        </child>
-                                        <child>
-                                            <widget class="kiwi+ui+widgets+entry+Entry" id="workpermit_serie">
-                                                <property name="data_type">str</property>
-                                                <property name="model_attribute">series_number</property>
-                                            </widget>
-                                            <packing>
-                                                <property name="bottom_attach">2</property>
-                                                <property name="left_attach">1</property>
-                                                <property name="right_attach">2</property>
-                                                <property name="top_attach">1</property>
-                                            </packing>
-                                        </child>
-                                    </widget>
-                                </child>
-                            </widget>
-                            <packing>
-                                <property name="position">1</property>
-                            </packing>
-                        </child>
-                    </widget>
-                    <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="top_attach">3</property>
                     </packing>
                 </child>
                 <child>
@@ -476,6 +378,9 @@
                                         <property name="visible">True</property>
                                         <property name="xalign">1.0</property>
                                     </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
                                 </child>
                                 <child>
                                     <widget class="GtkLabel" id="pis_registry_date_label">
@@ -486,6 +391,7 @@
                                     <packing>
                                         <property name="bottom_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -497,21 +403,25 @@
                                     <packing>
                                         <property name="bottom_attach">3</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="pis_number">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">pis_number</property>
                                     </widget>
                                     <packing>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="pis_registry_date">
                                         <property name="data_type">date</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">pis_registry_date</property>
                                     </widget>
                                     <packing>
@@ -519,11 +429,13 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="pis_bank">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">pis_bank</property>
                                     </widget>
                                     <packing>
@@ -531,6 +443,80 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                            </widget>
+                        </child>
+                    </widget>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkFrame" id="frame7">
+                        <property name="border_width">2</property>
+                        <property name="label" context="yes" translatable="yes">Personal Details</property>
+                        <property name="visible">True</property>
+                        <child>
+                            <widget class="GtkTable" id="table5">
+                                <property name="border_width">5</property>
+                                <property name="column_spacing">5</property>
+                                <property name="n_columns">2</property>
+                                <property name="n_rows">2</property>
+                                <property name="row_spacing">5</property>
+                                <property name="visible">True</property>
+                                <child>
+                                    <widget class="GtkLabel" id="education_level_label">
+                                        <property name="justify">right</property>
+                                        <property name="label" context="yes" translatable="yes">Education 
+Level:</property>
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1.0</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <widget class="GtkLabel" id="person_dependent_number_label">
+                                        <property name="justify">right</property>
+                                        <property name="label" context="yes" translatable="yes">Dependent 
+Number:</property>
+                                        <property name="visible">True</property>
+                                        <property name="xalign">1.0</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="bottom_attach">2</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <widget class="kiwi+ui+widgets+entry+Entry" id="education_level">
+                                        <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
+                                        <property name="model_attribute">education_level</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                        <property name="y_options">fill</property>
+                                    </packing>
+                                </child>
+                                <child>
+                                    <widget class="kiwi+ui+widgets+entry+Entry" id="dependent_person_number">
+                                        <property name="data_type">int</property>
+                                        <property name="is_focus">True</property>
+                                        <property name="model_attribute">dependent_person_number</property>
+                                    </widget>
+                                    <packing>
+                                        <property name="bottom_attach">2</property>
+                                        <property name="left_attach">1</property>
+                                        <property name="right_attach">2</property>
+                                        <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                             </widget>
@@ -549,7 +535,7 @@
                         <property name="label" context="yes" translatable="yes">Bank Information</property>
                         <property name="visible">True</property>
                         <child>
-                            <widget class="GtkTable" id="table5">
+                            <widget class="GtkTable" id="table8">
                                 <property name="border_width">5</property>
                                 <property name="column_spacing">5</property>
                                 <property name="n_columns">2</property>
@@ -562,6 +548,9 @@
                                         <property name="visible">True</property>
                                         <property name="xalign">1.0</property>
                                     </widget>
+                                    <packing>
+                                        <property name="y_options">fill</property>
+                                    </packing>
                                 </child>
                                 <child>
                                     <widget class="GtkLabel" id="bank_agency_label">
@@ -572,6 +561,7 @@
                                     <packing>
                                         <property name="bottom_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
@@ -583,21 +573,25 @@
                                     <packing>
                                         <property name="bottom_attach">3</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="name">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">name</property>
                                     </widget>
                                     <packing>
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="branch">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">branch</property>
                                     </widget>
                                     <packing>
@@ -605,11 +599,13 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">1</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                                 <child>
                                     <widget class="kiwi+ui+widgets+entry+Entry" id="account">
                                         <property name="data_type">str</property>
+                                        <property name="is_focus">True</property>
                                         <property name="model_attribute">account</property>
                                     </widget>
                                     <packing>
@@ -617,6 +613,7 @@
                                         <property name="left_attach">1</property>
                                         <property name="right_attach">2</property>
                                         <property name="top_attach">2</property>
+                                        <property name="y_options">fill</property>
                                     </packing>
                                 </child>
                             </widget>
@@ -629,6 +626,15 @@
                         <property name="top_attach">2</property>
                     </packing>
                 </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                    </packing>
+                </child>
             </widget>
         </child>
     </widget>

Added: stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleHistorySlave.glade
==============================================================================
--- (empty file)
+++ stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleHistorySlave.glade	Wed Dec 14 12:22:37 2005
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd">
+<glade-interface>
+    <widget class="GtkWindow" id="EmployeeRoleHistorySlave">
+        <property name="can_focus">True</property>
+        <child>
+            <widget class="kiwi+ui+widgets+list+List" id="history_list">
+                <property name="selection_mode">single</property>
+                <property name="shadow_type">in</property>
+                <property name="vscrollbar_policy">automatic</property>
+            </widget>
+        </child>
+    </widget>
+</glade-interface>

Added: stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleSlave.glade
==============================================================================
--- (empty file)
+++ stoq/trunk/stoq/gui/slaves/glade/EmployeeRoleSlave.glade	Wed Dec 14 12:22:37 2005
@@ -0,0 +1,220 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd">
+<glade-interface>
+    <widget class="GtkWindow" id="EmployeeRoleSlave">
+        <property name="default_height">250</property>
+        <property name="default_width">440</property>
+        <child>
+            <widget class="GtkTable" id="table1">
+                <property name="column_spacing">5</property>
+                <property name="n_columns">5</property>
+                <property name="n_rows">3</property>
+                <property name="row_spacing">5</property>
+                <property name="visible">True</property>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="x_options">&lt;flags GTK_FILL of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags GTK_FILL of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label2">
+                        <property name="label" context="yes" translatable="yes">Role:</property>
+                        <property name="visible">True</property>
+                        <property name="xalign">1.0</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="kiwi+ui+widgets+entry+Entry" id="role">
+                        <property name="data_type">object</property>
+                        <property name="mandatory">True</property>
+                        <property name="model_attribute">role</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkHButtonBox" id="hbuttonbox1">
+                        <property name="layout_style">end</property>
+                        <property name="visible">True</property>
+                        <child>
+                            <widget class="GtkButton" id="role_editor_button">
+                                <property name="is_focus">True</property>
+                                <property name="label" context="yes" translatable="yes">A_dd/Edit Role...</property>
+                                <property name="use_underline">True</property>
+                                <property name="visible">True</property>
+                            </widget>
+                        </child>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">1</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">3</property>
+                        <property name="right_attach">4</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label3">
+                        <property name="label" context="yes" translatable="yes">Salary:</property>
+                        <property name="visible">True</property>
+                        <property name="xalign">1.0</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="left_attach">3</property>
+                        <property name="right_attach">4</property>
+                        <property name="top_attach">1</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkLabel" id="label5">
+                        <property name="label" context="yes" translatable="yes">Comission:</property>
+                        <property name="visible">True</property>
+                        <property name="xalign">1.0</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">3</property>
+                        <property name="left_attach">3</property>
+                        <property name="right_attach">4</property>
+                        <property name="top_attach">2</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <placeholder/>
+                    <packing>
+                        <property name="left_attach">4</property>
+                        <property name="right_attach">5</property>
+                        <property name="x_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                        <property name="y_options">&lt;flags 0 of type GtkAttachOptions&gt;</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="kiwi+ui+widgets+entry+Entry" id="salary">
+                        <property name="data_type">float</property>
+                        <property name="is_focus">True</property>
+                        <property name="mandatory">True</property>
+                        <property name="model_attribute">salary</property>
+                        <property name="width_request">80</property>
+                        <property name="xalign">1.0</property>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">2</property>
+                        <property name="left_attach">4</property>
+                        <property name="right_attach">5</property>
+                        <property name="top_attach">1</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkHBox" id="hbox1">
+                        <property name="spacing">6</property>
+                        <property name="visible">True</property>
+                        <child>
+                            <widget class="kiwi+ui+widgets+spinbutton+SpinButton" id="comission">
+                                <property name="adjustment">0 0 100 1 10 0</property>
+                                <property name="data_type">float</property>
+                                <property name="digits">2</property>
+                                <property name="text" context="yes" translatable="yes">0.00</property>
+                                <property name="xalign">1.0</property>
+                            </widget>
+                        </child>
+                        <child>
+                            <widget class="GtkLabel" id="label6">
+                                <property name="label" context="yes" translatable="yes">%</property>
+                                <property name="visible">True</property>
+                            </widget>
+                            <packing>
+                                <property name="position">1</property>
+                            </packing>
+                        </child>
+                    </widget>
+                    <packing>
+                        <property name="bottom_attach">3</property>
+                        <property name="left_attach">4</property>
+                        <property name="right_attach">5</property>
+                        <property name="top_attach">2</property>
+                        <property name="x_options">fill</property>
+                        <property name="y_options">fill</property>
+                    </packing>
+                </child>
+            </widget>
+        </child>
+    </widget>
+</glade-interface>

Modified: stoq/trunk/stoq/gui/templates/glade/PersonEditorTemplate.glade
==============================================================================
--- stoq/trunk/stoq/gui/templates/glade/PersonEditorTemplate.glade	(original)
+++ stoq/trunk/stoq/gui/templates/glade/PersonEditorTemplate.glade	Wed Dec 14 12:22:37 2005
@@ -247,6 +247,17 @@
                                 <property name="position">4</property>
                             </packing>
                         </child>
+                        <child>
+                            <widget class="GtkEventBox" id="role_holder">
+                                <property name="visible">True</property>
+                                <child>
+                                    <placeholder/>
+                                </child>
+                            </widget>
+                            <packing>
+                                <property name="position">5</property>
+                            </packing>
+                        </child>
                     </widget>
                     <packing>
                         <property name="menu_label" context="yes" translatable="yes"></property>
@@ -352,7 +363,6 @@
                 <child>
                     <widget class="GtkVBox" id="custom_tab">
                         <property name="border_width">5</property>
-                        <property name="spacing">5</property>
                         <child>
                             <widget class="GtkEventBox" id="custom_holder">
                                 <property name="border_width">5</property>
@@ -364,8 +374,27 @@
                         </child>
                     </widget>
                     <packing>
+                        <property name="menu_label" context="yes" translatable="yes"></property>
                         <property name="position">3</property>
-                        <property name="tab_label" context="yes" translatable="yes">Custom tab</property>
+                        <property name="tab_label" context="yes" translatable="yes">Custom Tab</property>
+                    </packing>
+                </child>
+                <child>
+                    <widget class="GtkVBox" id="extra_tab">
+                        <property name="border_width">5</property>
+                        <child>
+                            <widget class="GtkEventBox" id="extra_holder">
+                                <property name="border_width">5</property>
+                                <property name="visible">True</property>
+                                <child>
+                                    <placeholder/>
+                                </child>
+                            </widget>
+                        </child>
+                    </widget>
+                    <packing>
+                        <property name="position">4</property>
+                        <property name="tab_label" context="yes" translatable="yes">Extra Tab</property>
                     </packing>
                 </child>
             </widget>

Modified: stoq/trunk/stoq/gui/templates/person.py
==============================================================================
--- stoq/trunk/stoq/gui/templates/person.py	(original)
+++ stoq/trunk/stoq/gui/templates/person.py	Wed Dec 14 12:22:37 2005
@@ -64,12 +64,21 @@
         'email'
         ) + left_proxy_widgets
 
-    def attach_custom_slave(self, slave, tab_text):
+    def attach_custom_slave(self, slave, tab_label):
         self.custom_tab.show()
         tab_child = self.custom_tab
-        self.person_notebook.set_tab_label_text(tab_child, tab_text)
+        self.person_notebook.set_tab_label_text(tab_child, tab_label)
         self.attach_slave('custom_holder', slave)
 
+    def attach_role_slave(self, slave):
+        self.attach_slave('role_holder', slave)
+
+    def attach_extra_slave(self, slave, tab_label):
+        self.extra_tab.show()
+        tab_child = self.extra_tab
+        self.person_notebook.set_tab_label_text(tab_child, tab_label)
+        self.attach_slave('extra_holder', slave)
+
     def create_model(self, conn):
         # XXX: Waiting fix for bug 2163
         return Person(name="", connection=conn)

Modified: stoq/trunk/stoq/lib/parameters.py
==============================================================================
--- stoq/trunk/stoq/lib/parameters.py	(original)
+++ stoq/trunk/stoq/lib/parameters.py	Wed Dec 14 12:22:37 2005
@@ -43,9 +43,9 @@
                                                instance that represents
                                                the company's warehouse.
 
-    * DEFAULT_EMPLOYEE_ROLE(EmployeeRole): The employee role
-                                                   suggested when we are
-                                                   adding a new employee.
+    * DEFAULT_SALESPERSON_ROLE(EmployeeRole): The employee role
+                                              suggested when we are
+                                              adding a new salesperson.
 
     * SUGGESTED_SUPPLIER(PersonAdaptToSupplier): The supplier suggested 
                                                  when we are adding a new
@@ -250,7 +250,7 @@
                                'person.PersonAdaptToBranch'),
                  ParameterAttr('DEFAULT_BASE_CATEGORY', 
                                'sellable.BaseSellableCategory'),
-                 ParameterAttr('DEFAULT_EMPLOYEE_ROLE', 
+                 ParameterAttr('DEFAULT_SALESPERSON_ROLE', 
                                'person.EmployeeRole'),
                  ParameterAttr('DEFAULT_PAYMENT_DESTINATION', 
                                'payment.destination.PaymentDestination'),
@@ -327,7 +327,7 @@
         # always here
         self.ensure_suggested_supplier()
         self.ensure_default_base_category()
-        self.ensure_default_employee_role()
+        self.ensure_default_salesperson_role()
         self.ensure_current_branch()
         self.ensure_current_warehouse()
         self.ensure_payment_destination()
@@ -363,12 +363,12 @@
                                         category_data=abstract_cat)
         self.set_schema(key, base_cat.id)
 
-    def ensure_default_employee_role(self):
+    def ensure_default_salesperson_role(self):
         from stoq.domain.person import EmployeeRole
-        key = "DEFAULT_EMPLOYEE_ROLE"
+        key = "DEFAULT_SALESPERSON_ROLE"
         if self.get_parameter_by_field(key, EmployeeRole):
             return
-        role = EmployeeRole(name='Sales Person', 
+        role = EmployeeRole(name='Salesperson', 
                                     connection=self.conn)
         self.set_schema(key, role.id)
 

Modified: stoq/trunk/stoq/tests/test_parameters.py
==============================================================================
--- stoq/trunk/stoq/tests/test_parameters.py	(original)
+++ stoq/trunk/stoq/tests/test_parameters.py	Wed Dec 14 12:22:37 2005
@@ -65,7 +65,7 @@
         assert isinstance(company, companyTable)
  
     def test_DefaultEmployeeRole(self):
-        employee_role = self.sparam.DEFAULT_EMPLOYEE_ROLE
+        employee_role = self.sparam.DEFAULT_SALESPERSON_ROLE
         assert isinstance(employee_role, EmployeeRole)
    
     def test_SuggestedSupplier(self):


More information about the POS-commit mailing list