This question has been flagged

I need set valuse from my table, for use this in my template. 

code:


js:


console.log('Hi im work')
odoo.define('sale.ch15_r01_drag', function (require) {
'use strict';
var core = require('web.core');
var QWeb = core.qweb;
var relational_fields = require('web.relational_fields');
var registry = require('web.field_registry');
var rpc = require('web.rpc');
// var model = new instance.web.Model("oepetstore.message_of_the_day");
var ContactDragWidget = relational_fields.FieldMany2Many.extend({
template: "Field.Drag.template",
events: {
'click .o_attach': '_onAttach',
'click .o_attachment_delete': '_onDelete',
'change .o_input_file': '_onFileChanged',
},
fieldsToFetch: {
display_name: {id: 'integer'},
mimetype: {type: 'char'},
},

willStart: function() {
return Promise.all([
this._super.apply(this, arguments),
this._getHtml()
]);
},

qweb:

<t t-name="Field.Drag.template">
<t t-if="data" t-set="file" t-value="file.data"/>
<t t-set="editable" t-value="widget.mode === 'edit'"/>
<t t-if="mimetype" t-set="mimetype" t-value="mimetype"/>
<div class="d-flex flex-wrap justify-content-around" >
<span><t t-esc="Value from table"/>Hello world</span>
<t t-foreach="widget.categories" t-as="i">
<article class="article-category">
<div class="article-category_header d-flex justify-content-between align-items-baseline"><h4><t t-esc="i"/></h4><button t-if="widget.mode !== 'readonly'" class="btn btn-secondary o_attach" title="Attach"><span class="fa fa-paperclip" aria-label="Attach"/>Add</button></div>
<!-- <div class="article-category_content">-->
<!-- <div t-if="file.category_id === i" class="attachment-item">-->

<!-- </div>-->
<!-- </div>-->
<div class="oe_placeholder_files"/>
<div t-if="widget.mode !== 'readonly'" class="oe_add">
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" />
<t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t>
<t t-set="multi_upload" t-value="true"/>
<input type="hidden" name="model" t-att-value="widget.model"/>
<input type="hidden" name="id" value="0"/>
</t>
</div>
</article>
</t>
Avatar
Discard

Hello, Did you ever find a solution to this? I am struggling with this very thing. Thanks