def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) if not self.individual_slave: raise ValueError('This editor must have an individual slave') self.details_slave = EmployeeDetailsSlave(self.store, self.model, visual_mode=self.visual_mode) custom_tab_label = _('Employee Data') slave = self.individual_slave slave._person_slave.add_extra_tab(custom_tab_label, self.details_slave) self.status_slave = EmployeeStatusSlave(self.store, self.model, visual_mode=self.visual_mode) slave.attach_person_slave(self.status_slave) self.role_slave = EmployeeRoleSlave(self.store, self.model, edit_mode=self.edit_mode, visual_mode=self.visual_mode) db_form = self._person_slave.db_form slave._person_slave.attach_role_slave(self.role_slave) if db_form: db_form.update_widget(self.role_slave.role, other=self.role_slave.role_lbl) db_form.update_widget(self.role_slave.salary, other=self.role_slave.salary_lbl) history_tab_label = _("Role History") history_slave = EmployeeRoleHistorySlave(self.model) slave._person_slave.add_extra_tab(history_tab_label, history_slave)
def __init__(self, store, model=None, person=None, role_type=None, visual_mode=False, parent=None, document=None, description=None): self.visual_mode = visual_mode # Do not allow users of one branch edit employee from a different # branch if (model and model.branch and not model.branch == api.get_current_branch(store)): self.visual_mode = True BasePersonRoleEditor.__init__(self, store, model, role_type=role_type, person=person, visual_mode=self.visual_mode, parent=parent, document=document, description=description)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) self.details_slave = TransporterDataSlave(self.store, self.model, visual_mode=self.visual_mode) slave = self.main_slave.get_person_slave() slave.attach_slave('person_status_holder', self.details_slave)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave( self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.attach_custom_slave(self.user_details, tab_text) tab_child = self.main_slave._person_slave.custom_tab notebook = self.main_slave._person_slave.person_notebook notebook.reorder_child(tab_child, position=self.USER_TAB_POSITION) notebook.set_current_page(self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.attach_extra_slave(self.user_branches, tab_text)
def setup_slaves(self): from .opticalslave import MedicDetailsSlave BasePersonRoleEditor.setup_slaves(self) tab_text = _('Medic Details') self.medic_details_slave = MedicDetailsSlave( self.store, self.model, visual_mode=self.visual_mode) self.main_slave._person_slave.add_extra_tab(tab_text, self.medic_details_slave)
def setup_slaves(self): from .opticalslave import MedicDetailsSlave BasePersonRoleEditor.setup_slaves(self) tab_text = _('Medic Details') self.medic_details_slave = MedicDetailsSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave._person_slave.add_extra_tab(tab_text, self.medic_details_slave)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) self.status_slave = ClientStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(self.status_slave) credit_slave = ClientCreditSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave._person_slave.add_extra_tab('Credit Details', credit_slave)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) self.status_slave = ClientStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(self.status_slave) credit_slave = ClientCreditSlave(self.store, self.model, visual_mode=self.visual_mode, edit_mode=self.edit_mode) self.main_slave._person_slave.add_extra_tab(_('Credit Details'), credit_slave)
def __init__(self, store, model=None, person=None, role_type=None, visual_mode=False, parent=None, document=None): self.visual_mode = visual_mode # Do not allow users of one branch edit employee from a different # branch if (model and model.branch and not model.branch == api.get_current_branch(store)): self.visual_mode = True BasePersonRoleEditor.__init__(self, store, model, role_type=role_type, person=person, visual_mode=self.visual_mode, parent=parent, document=document)
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) return person.login_user or LoginUser(person=person, store=store, username=u"", password=u"", profile=None)
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) branch = person.branch if branch is None: branch = Branch(person=person, store=store) return branch
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) publisher = store.find(BookPublisher, person=person).one() if publisher is None: publisher = BookPublisher(person=person, store=store) return publisher
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) transporter = person.transporter if transporter is None: transporter = Transporter(person=person, store=store) return transporter
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) if not person.individual: Individual(person=person, store=self.store) employee = person.employee if not employee: employee = Employee(person=person, store=store, role=None) return employee
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)
def create_model(self, store): # Document used in MedicEditor is the CRM number crm = self.document self.document = None person = BasePersonRoleEditor.create_model(self, store) medic = store.find(OpticalMedic, person=person).one() if medic is None: medic = OpticalMedic(person=person, store=store, crm_number=crm) return medic
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) self.status_slave = BranchDetailsSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(self.status_slave)
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) medic = store.find(OpticalMedic, person=person).one() if medic is None: medic = OpticalMedic(person=person, store=store) return medic
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) client = person.client if client is None: client = Client(person=person, store=store) return client
def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) supplier = person.supplier if supplier is None: supplier = Supplier(person=person, store=store) return supplier