-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Add view to generate invoice for contribution #5331
Conversation
</tr> | ||
</table> | ||
</div> | ||
</body> |
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.
indent this by +1 ?
<meta charset="utf-8"> | ||
{% include 'shared/head.html' %} | ||
{% include 'shared/cards.html' %} | ||
|
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.
^ deindent these by 1
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.
@zoek1 could you throw in a screenshot of the invoice page ?
Hey Miguel - thanks for your PR - next time if you are submitting a PR thats still a WIP, please use the draft PR function - thanks! |
Sure, I'll add the screenshot and update the PR description. |
Codecov Report
@@ Coverage Diff @@
## master #5331 +/- ##
==========================================
- Coverage 29.85% 29.63% -0.22%
==========================================
Files 241 242 +1
Lines 20406 20819 +413
Branches 2918 3009 +91
==========================================
+ Hits 6092 6170 +78
- Misses 14063 14397 +334
- Partials 251 252 +1
Continue to review full report at Codecov.
|
@zoek1 is this ready for review now? |
Yep, it's ready for review! |
</td> | ||
|
||
<td> | ||
0x2af47a65da8cd66729b4209c22017d6a5c2d2400 |
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.
Whats up with this hardcoded value?
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.
I based this invoice on the invoice template for bounties, I took the value from there. As I understand this address represents the gitcoin address to manage such transactions. This value is hardcoded in other places in the codebase, what is recommended in this cases? @danlipert
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.
So I took a look and actually its the Bounties Network v1 Contract Address, which doesn't make sense here... lets use the grant contract address for each grant instead.
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.
Done! 😀
app/grants/views.py
Outdated
contribution = Contribution.objects.prefetch_related('subscription', 'subscription__grant').get(pk=contribution_pk) | ||
|
||
# only allow invoice viewing if admin or if grant contributor | ||
is_contributor = request.user.username.lower().lstrip('@') == contribution.subscription.contributor_profile.handle.lower().lstrip('@') |
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.
hmm.. probably can do this logic simpler like has_view_privs = request.user.is_staff or request.user.profile == contribution.subscription.contributor_profile
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.
Cool, i just changed!
Description
When a contribution is made to Gitcoin Grant, an invoice is created using the Gitcoin Bounties template.
Each contribution has an invoice and is displayed only to contribution owner:
Display invoice contribution:
Refers/Fixes
#4264
Testing