Skip to content
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

fix: Handle None value for item description in customer portal invoice view (backport #43823) #43889

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 29, 2024

If the description was not set in an item it throws an error in the customer portal invoice view.

Steps to replicate:

  • Create an invoice without a description.
  • View that invoice in customer portal.

Before:
image

After:
image

backport-version-15

Traceback ```log Traceback (most recent call last): File "apps/frappe/frappe/website/serve.py", line 20, in get_response response = renderer_instance.render() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render html = self.get_html() ^^^^^^^^^^^^^^^ File "apps/frappe/frappe/website/utils.py", line 523, in cache_html_decorator html = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/website/page_renderers/template_page.py", line 101, in get_html html = self.render_template() ^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/website/page_renderers/template_page.py", line 236, in render_template html = frappe.render_template(self.source, self.context, safe_render=safe_render) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/utils/jinja.py", line 97, in render_template return get_jenv().from_string(template).render(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "env/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 179, in top-level template code File "apps/frappe/frappe/templates/web.html", line 1, in top-level template code {% extends base_template_path %} ^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/templates/base.html", line 77, in top-level template code {% block content %} File "apps/frappe/frappe/templates/web.html", line 63, in block 'content' {{ main_content() }} File "env/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call return __context.call(__obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke rv = self._func(*arguments) ^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/templates/web.html", line 15, in template {% block page_container %} ^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/templates/web.html", line 30, in block 'page_container' {%- block page_content -%}{%- endblock -%} ^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 110, in block 'page_content' File "env/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call return __context.call(__obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke rv = self._func(*arguments) ^^^^^^^^^^^^^^^^^^^^^^ File "", line 176, in template File "env/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call return __context.call(__obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "apps/frappe/frappe/core/utils.py", line 91, in html2text return md(html, heading_style="ATX", strip=strip, wrap=wrap) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/markdownify/__init__.py", line 395, in markdownify return MarkdownConverter(**options).convert(html) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/markdownify/__init__.py", line 96, in convert soup = BeautifulSoup(html, 'html.parser') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "env/lib/python3.11/site-packages/bs4/__init__.py", line 315, in __init__ elif len(markup) <= 256 and ( ^^^^^^^^^^^ TypeError: object of type 'NoneType' has no len()
```

This is an automatic backport of pull request #43823 done by [Mergify](https://mergify.com).

@nabinhait nabinhait merged commit 8a72845 into version-15-hotfix Oct 29, 2024
6 checks passed
@nabinhait nabinhait deleted the mergify/bp/version-15-hotfix/pr-43823 branch October 29, 2024 17:08
frappe-pr-bot pushed a commit that referenced this pull request Oct 30, 2024
# [15.40.0](v15.39.6...v15.40.0) (2024-10-30)

### Bug Fixes

* add company filter for project ([33fa1e4](33fa1e4))
* add parenttype clause to invoice tax query in sales_register report ([603d2cf](603d2cf))
* backport translations from develop ([#43849](#43849)) ([11dd196](11dd196))
* basic rate not editable in Stock Entry Detail (backport [#43837](#43837)) ([#43838](#43838)) ([20478b6](20478b6))
* better implementation, handle missing purchase order ([41db040](41db040))
* Calculate gross margin on update of project costing from invoices (backport [#43876](#43876)) ([#43900](#43900)) ([93d0db2](93d0db2))
* calculate tds with net amount when invoice exceeds single threshold amount (backport [#43869](#43869)) ([#43920](#43920)) ([9a52661](9a52661))
* cannot create opp from lead without prospect ([4dcaf42](4dcaf42))
* consider gle based on balances in company currency ([#43805](#43805)) ([2fb4417](2fb4417))
* consider opening asset values while calculating asset depreciation rate ([1af2326](1af2326))
* correct garbage value on Razorpay Payments Page ([2c21df2](2c21df2))
* do not check for payment terms details for return invoices. ([9a5604c](9a5604c))
* do not copy serial numbers from DN to SI (backport [#43885](#43885)) ([#43893](#43893)) ([d06831e](d06831e))
* do not set payment terms for return invoices ([a826a89](a826a89))
* find first PCV to consider opening entries ([8218ca9](8218ca9))
* Handle None value for item description in customer portal invoice view (backport [#43823](#43823)) ([#43889](#43889)) ([8a72845](8a72845))
* hide payment terms for return and paid purchase invoices ([29aa5d6](29aa5d6))
* incorrect value of available_qty_for_consumption in subcontracti… (backport [#43836](#43836)) ([#43861](#43861)) ([cd4746a](cd4746a))
* map doc from purchase order ([58a3ef7](58a3ef7))
* Patch for reposting account closing balance (backport [#43905](#43905)) ([#43910](#43910)) ([ab16207](ab16207))
* post account closing balance against pcv closing account (backport [#43887](#43887)) ([#43898](#43898)) ([e22d0a3](e22d0a3))
* purchase return validation issue (backport [#43871](#43871)) (backport [#43874](#43874)) ([#43879](#43879)) ([db3be41](db3be41))
* recalculate outstanding after save on checkout for POS Invoice ([63668eb](63668eb))
* remarks field in payment reconciliation ([8707090](8707090))
* **RFQ:** make strings translatable (backport [#43843](#43843)) ([#43848](#43848)) ([07aaef2](07aaef2))
* rounding issue of required qty in subcontracting order ([#43908](#43908)) ([9ac87bd](9ac87bd))
* scrub "-" from fieldname in accounting dimension ([c702826](c702826))
* set bill_no before `against_voucher` gets concatenated ([81297ce](81297ce))
* set default warehouse for pos invoice ([b80a5f2](b80a5f2))
* set proper currency format ([9f97018](9f97018))
* Unnecessary validation for non deferred sales invoices ([#43816](#43816)) ([bf4fb53](bf4fb53))
* use period closing voucher object to call get_account_closing_ba… (backport [#43880](#43880)) ([#43883](#43883)) ([8bfc212](8bfc212))
* validate fieldname ([b21abf4](b21abf4))
* work order finish button not showing (backport [#43875](#43875)) (backport [#43877](#43877)) ([#43904](#43904)) ([7189dab](7189dab))

### Features

* add party name in payment request ([935f2e1](935f2e1))

### Performance Improvements

* performance optimizations for accounting reports by refactoring account closing balance and period closing voucher ([#43798](#43798)) ([ced76ca](ced76ca))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants