-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entreprises mandataires #1302
Entreprises mandataires #1302
Conversation
T'as fait ça :) |
def test_mandated_companies(self): | ||
""" | ||
Un·e utilisateur·ice doit voir les entreprises representées par son | ||
entreprise - et ce avec le même rôle de déclarant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can managers without a declarant role also see the companies their company represents ?
Edit to add : in general I am a little confused over the different permissions both the declarant role and the supervisor role have in relation to the companies they represent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct : managers of a company have also a view on the mandated declarations. The only difference is they can't create or modify declarations.
Merci bcp pour ta vigilance ! En effet il y a une différence de droits d'accès entre superviseurs et déclarant·e·s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix : 061fe06
reverse("api:list_create_declaration", kwargs={"user_pk": authenticate.user.id}), payload, format="json" | ||
) | ||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a test for listing declarations of the companies represented by my company?
I'm wondering what the behaviour should be if company A creates a declaration for company B and then A is removed from B's mandated_companies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ça c'est justement un sujet un peu plus large qu'on attaquera par la suite car il s'applique aussi aux déclarant·e·s au sens large... par ex, si une compagnie enlève une personne déclarante comment on le gère ? Est-ce que cette personne est encore l'auteur·ice ? J'ai volontairement laissé ce sujet pour après.
|
||
const companiesSelectOptions = computed(() => { | ||
return companies.value?.map((x) => ({ | ||
text: `${x.socialName} ${x.representedBy ? "(représenté par " + x.representedBy.socialName + ")" : ""}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a many-to-many model, how does the list work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Un petit hack : chaque option du select a comme value
une combinaison des deux IDs : celui de la compagnie et celui de l'entreprise mandatée pour la compagnie. Par exemple, une valeur avec le texte « Guichard (représenté par Prevost) » aurait comme value
< id de Guichard >|< id de Prévost >, par exemple 23|94
.
Lors que le v-model
du select change, on parse les deux IDs et on les assigne aux vraies valeurs, donc le 23
irait dans payload.company
et le 94
irait dans payload.mandatedCompany
.
….vue Co-authored-by: hfroot <[email protected]>
Co-authored-by: hfroot <[email protected]>
Closes #925
Entreprises mandataires
Frontend : Désigner une entreprise mandataire
Un personne avec rôle gestionnaire peut mandater une entreprise pour faire des déclarations en leur nom. Pour ceci, une nouvelle
Screencast.from.2024-11-28.11-46-43.mp4
Le ou la gestionnaire peut aussi enlever une entreprise mandatée de la liste :
Screencast.from.2024-12-02.17-57-56.mp4
En cas d'ajout d'une entreprise qui n'existe pas chez nous :
Screencast.from.2024-12-02.17-59-22.mp4
Frontend : choisir une entreprise mandataire
Un·e déclarant·e peut choisir dans le menu déroulant une entreprise mandataire. Ceci est explicité directement dans les options :
Screencast.from.2024-11-28.11-52-17.mp4
Backend : modèles
mandated_companies
dans CompanyLe champ champ many-2-many
mandated_companies
contient les entreprises ayant droit de déclarer au nom de la compagnie.mandated_company
dans DeclarationLe champ
mandated_company
spécifie l'entreprise mandataire qui gère la déclaration. Lors que la déclaration n'a pas été faite par mandat, ce champ est null.Ceci nous permet de gérer les permissions : on peut donc montrer seulement les déclarations mandatées par une entreprise à ses déclarants, et non pas la totalité de déclarations.
API
Deux endpoints RPC-like ont été ajoutés :
📧 La view correspondante envoie aussi un email aux gestionnaires de l'entreprise mandatée pour notifier de l'ajout du mandat.
🚫 Pour l'instant il n'y a pas d'email envoyé lors de l’enlèvement d'une entreprise mandatée. Ceci pourrait être ajoute après.
Évolutions possibles
Modal de confirmation avant de supprimer un mandat