Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

Hi,


I'm in the process of upgrading Odoo from v16 to v18.

I have already fixed many errors and updated code that was causing conflicts.

At the moment, I can navigate through all applications without issues except for the Website, which always returns the following error:


Error while render the template

UnboundLocalError: cannot access local variable 'template' where it is not associated with a value

Template: website.layout

Path: /t/html/body/div[2]/main/div[1]

Node: <div t-if="o_portal_fullwidth_alert" class="container mt-3"/>


This happens on every possible page of the website.

Over time, I have made many modifications to views, so I’m concerned I might have broken something.

If that’s the case, could you advise me on how I can debug or fix this? I’m not sure where to start.

While inspecting the views, I found the following block:


<xpath expr="//div[@id='wrapwrap']/main/t[@t-out='0']" position="before">
    <div t-if="o_portal_fullwidth_alert or False" class="container mt-3">
        <div class="alert alert-info alert-dismissible fade show d-print-none css_editable_mode_hidden">
            <t t-out="o_portal_fullwidth_alert"/>
        </div>
    </div>
</xpath>

It seems this block might be related to the div with id="wrapwrap".

I suspect that the error could be triggered by this piece of code, but I’m not sure why it causes the UnboundLocalError.


Extra information:

  • When creating a brand new website (as expected), no error occurs.


Attempts to fix:

  1. Commented out the problematic block.
  2. Reviewed inherited views in website.layout for possible conflicts (I may still missing something).
  3. Verified that a brand new website (with no custom views) works fine, confirming that the problem is specific to the upgraded/customized site.


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 22
8852
0
lip 25
390
Custom web forms Rozwiązane
3
sie 24
2381
0
mar 15
5435
1
cze 25
863