Exemplo n.º 1
0
    def create_model(self):
        user = self._user
        branch = self.target_combo.get_selected_data()

        if UserBranchAccess.has_access(self._store, user, branch):
            info(
                _(u'%s is already associated with %s.') %
                (user.person.name, branch.get_description()))
            return

        return UserBranchAccess(store=self._store, user=user, branch=branch)
Exemplo n.º 2
0
def branch_with_access(store, client, example_creator):
    branch = example_creator.create_branch(cnpj='99.399.705/0001-90')
    UserBranchAccess(store=store, user=client.user, branch=branch)
    return branch