-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Traceback in Statement view #743
Traceback in Statement view #743
Conversation
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.
Some very small changes. Thanks!
bika/lims/browser/invoicebatch.py
Outdated
number_link = "<a href='%s'>%s</a>" % ( | ||
item['url'], obj.getId() | ||
) | ||
item['replace']['id'] = number_link |
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.
Better to remove number_link
and use get_link
from utils
directly:
item['replace']['id'] = get_link(api.get_url(obj), obj.getId())
bika/lims/browser/invoicebatch.py
Outdated
item['client'] = obj.getClient().Title() | ||
item['replace']['client'] = "<a href='%s'>%s</a>" % ( | ||
obj.getClient().absolute_url(), item['client'] | ||
) |
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.
Again, better use get_link
bika/lims/browser/invoicebatch.py
Outdated
item['url'], obj.getId() | ||
) | ||
item['replace']['id'] = number_link | ||
if obj.getClient(): |
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.
Since you are using the client object in several places later, I suggest to use a local var to store the client:
client = obj.getClient()
if client:
[...]
and use it later instead of obj.getClient()
bika/lims/browser/invoicebatch.py
Outdated
) | ||
item['email'] = obj.getClient().getEmailAddress() | ||
item['replace']['email'] = "<a href='%s'>%s</a>" % ( | ||
'mailto:%s' % obj.getClient().getEmailAddress(), obj.getClient().getEmailAddress() |
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.
Better use get_email_link
from utils
:
item['replace']['email'] = get_email_link(client.getEmailAddress())
Since we are using the client object in several places it is better to store it in a local variable and use it when the client is needed.
…gallostra/bika.lims into traceback-in-statement-view
Description of the issue/feature this PR addresses
Linked issue: #733
Current behavior before PR
When navigating to the Statement's list and trying to access a Statement an error is raised. Furthermore, the traceback appears on the page the user is viewing.
The traceback of the error is:
Desired behavior after PR is merged
No traceback appears and the invoices are listed.
Screenshot (optional)
--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.