Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
7316 Vizualizări

how to resolve this error for creat a kanban view?

Retraçage :
Error: QWeb2 - template['kanban-box']: Error evaluating template: SyntaxError: Invalid regular expression flags
    at Object.exception (http://localhost:8069/web/content/573-5278fac/web.assets_common.js:3692:7)
    at Engine._render (http://localhost:8069/web/content/573-5278fac/web.assets_common.js:3735:12)
    at Engine.render (http://localhost:8069/web/content/573-5278fac/web.assets_common.js:3733:151)
    at Class._render (http://localhost:8069/web/content/574-608afe3/web.assets_backend.js:1896:722)
    at Class.start (http://localhost:8069/web/content/574-608afe3/web.assets_backend.js:1889:1336)
    at Class.prototype.<computed> [as start] (http://localhost:8069/web/content/573-5278fac/web.assets_common.js:3861:488)
    at http://localhost:8069/web/content/573-5278fac/web.assets_common.js:4101:52
    at async Promise.all (index 0)

class RecrutementCandidats(models.Model):
_name = "recrutement.candidatures"
_description = "Candidats Record"
_rec_name = "candidat_name"

candidat_name = fields.Char(string='Name', required=True, track_visibility="always")
image = fields.Binary(String="Image", attachment=True)
candidat_age = fields.Integer(String=" age")
 <record model="ir.ui.view" id="candidat_kanban">
     <field name="name">recrutement.candidatures.kanban</field>
<field name="model">recrutement.candidatures</field>
<field name="arch" type="xml">
<kanban>
<field name="id"/>
<field name="image"/>
<field name="candidat_name"/>
<field name="candidat_age"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_recrutement_candidatures_kanban">
<t t-if="record.image.raw_value">
<div class="o_kanban_image_fill_left d-none d-md-block" t-attf-style="background-image:url('#{kanban_image('recrutement.touscandidats', 'image', record.id.raw_value)}')"/>
</t>
<t t-else="">
<img class="o_kanban_image" t-att-src="_s +/hr/static/src/img/default_image.png" alt="Default"/>
</t>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title">
<field name="display_name"/>
</strong>
<div class="o_kanban_tags_section"/>
<ul>
<li>
Nom:
<field name="candidat_name"/>
</li>
<li>
Age :
<field name="candidat_age"/>
</li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>



Imagine profil
Abandonează
Cel mai bun răspuns

replace 

<div class="o_kanban_image_fill_left d-none d-md-block" t-attf-style="background-image:url('#{kanban_image('recrutement.touscandidats', 'image', record.id.raw_value)}')"/>


to

<div class="o_kanban_image"> <img t-att-src="kanban_image('recrutement.touscandidats', 'image', record.id.raw_value)" alt="recrutement" class="o_image_64_contain"/>
</div>

and
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_recrutement_candidatures_kanban">

replace with <div class="oe_kanban_global_click">
Imagine profil
Abandonează
Autor Cel mai bun răspuns

ok and think you

Imagine profil
Abandonează

if that answer resolve issue then please mark as best answer

Cel mai bun răspuns

Internal quotation marks are missing in the t-att-src path. Then it would be:


t-att-src='_s +"/hr/static/src/img/default_image.png"'


I hope it works for someone. This worked for me in Odoo 13

Imagine profil
Abandonează