Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Why doesn't my snippet data update?

By
Angela
on 2/10/16, 5:11 AM 511 views

I have the following Snippet code :

    <template id="snippet_colact_id" name="ColAct snippet">
<section class="oe_snippet_body snippet_colact_id">
<h3>Actions</h3>
<div t-esc="res_company.textHarvey()"/>
<div t-set="teachers" t-value="res_company.menusHarvey()"/>
<t t-foreach="teachers" t-as="teacher">
<p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p>
</t>
</section>
</template>


class res_company(models.Model):
def textHarvey(req):
return "hello harvey"
def menusHarvey(req):
id_colacts = openerp.pooler.get_pool(http.request.cr.dbname).get('a_colact_collaborativeaction').search(http.request.cr, http.request.uid, [])
colacts = openerp.pooler.get_pool(http.request.cr.dbname).get('a_colact_collaborativeaction').browse(http.request.cr, http.request.uid, id_colacts)
return colacts


When I drag my snippet onto the page the values are correctly extracted from the DB, but when I later change the values in Odoo and then refersh the page the values don't change. It looks like the values are retrieved when the Snippet is dropped onto the page and that they never change after?

Great ! That worked (copying my code into the HTML editor)... it's a shame the designer doens't just leave the Snippet as it is all the same...

Angela
on 2/10/16, 6:00 AM
0

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2983
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 2/10/16, 7:52 PM

hi. When you drop the snippet, you drop the rendered content. so if you want something of dynamic, you should add the snippets code in html editor. Like that, it will be rendered at fly and not only at drop. If you want to make it with drag and drop, you need to drop a placeholder and do it in Javascript.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/10/16, 5:11 AM
Seen: 511 times
Last updated: 2/10/16, 7:52 PM