콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
3841 화면

hey guys! I have a problem inheriting owl template and an qweb from 'mrp_workorder' module in my custom module... 

this is my code:

import { registry } from "@web/core/registry";

import { MrpDisplayRecord } from "@mrp_workorder/mrp_display/mrp_display_record";

export class MrpDisplayRecordInherited extends MrpDisplayRecord {    

// New Inherit template    

static template = "mrp_workorder.MrpDisplayRecordInherited";

    setup() {       

​// call original setup        

​super.setup();

        // New field        

​const numOt = this.props.production?.data?.num_ot || null;        

​this.numOt = numOt;        

​console.log("numero de ot:", numOt);    

}}

// registry 

registry.category("components").add("mrp_display_record", MrpDisplayRecordInherited);

num_ot is the field I need to add... so it can be shown in the qweb
this is the original one...

< templates xml:space="preserve">    

< t t-name="mrp_workorder.MrpDisplayRecordInherited">    

< t t-call="mrp_workorder.MrpDisplayRecord"/>  

     

  HERE SHOULD GO NEW DIV    

 < /t>   

 < /t>

< /templates> 



but nothing happenss.... 

please guys is someone knows something I will be really grateful for the help!

           



아바타
취소
베스트 답변

Try this in your template. This is to inherit the existing template and add your own div.


<t t-name="CUSTOM_MODULE_NAME.MrpDisplayRecordInherited" t-inherit="mrp_workorder.MrpDisplayRecord">
<xpath expr="//div[hasclass('o_finished_product')]/*" position="after">
<div class="CUSTOM_DIV_CLASS">
<span t-esc="num_ot"/></div>
        </xpath>
    </t>

       

           

Hope this helps!

아바타
취소
베스트 답변

I’m trying to customize the Optimize SEO page, specifically the website.TitleDescription section.

I found the original template as follows:

<t t-name="website.TitleDescription">
<section>
<div class="row">
<div class="col-lg-6">
<div class="mb-3">
<label for="website_meta_title">
Title <i class="fa fa-question-circle-o" title="The title will take a default value unless you specify one."/>
</label>
<input type="text" t-model="seoContext.title" t-att-disabled="!props.canEditTitle" class="form-control" placeholder="Keep empty to use default value" maxlength="70" size="70" t-ref="autofocus"/>
</div>
<div class="mb-3">
<label for="website_meta_description">
Description <i class="fa fa-question-circle-o" t-att-title="props.previewDescription"/>
</label>
<textarea t-model="seoContext.description" t-att-disabled="!props.canEditDescription" name="website_meta_description" placeholder="Keep empty to use default value" class="form-control"/>
<div t-if="descriptionWarning.length" class="alert alert-warning mt16 mb0 small">
<span t-esc="descriptionWarning"/>
</div>
</div>
<div class="mb-3" t-if='props.canEditUrl'>
<label for="website_seo_name">
Custom Url <i class="fa fa-question-circle-o" t-att-title="props.seoNameHelp" />
</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text seo_name_pre" t-esc="seoNamePre"/>
</div>
<input type="text" class="form-control" t-att-placeholder="props.seoNameDefault"
t-on-input="_updateInputValue" t-att-value="seoContext.seoName"/>
<div class="input-group-append" title="Unalterable unique identifier">
<span class="input-group-text seo_name_post" t-esc="seoNamePost"/>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card-header">Preview</div>
<div class="card mb0 p-0">
<div class="card-body">
<SEOPreview isIndexed="props.isIndexed" title="title" description="description" url="url"/>
</div>
</div>
</div>
</div>
</section>
</t>


I created an inherited template as follows:

<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="custom_Optimize_seo.TitleDescriptionInherit" t-inherit="website.TitleDescription">
<xpath expr="//input[@t-model='seoContext.title']" position="after">
<div class="est_ccs">
<h1>Test</h1>
</div>
</xpath>
</t>
</templates>


And my manifest file looks like this:

'assets': {
'web.assets_frontend': [
# 'theme_vcs/static/src/scss/style.scss',
],
'web.assets_backend': [
# 'website/static/src/components/dialog/seo.xml',
'custom_Optimize_seo/static/src/xml/seo_template.xml',
],
},


However, it’s not working as expected.

Could you please help me check the code?
Thank you very much!

아바타
취소
작성자 베스트 답변

it helped!!! thankssssssssss 

아바타
취소
관련 게시물 답글 화면 활동
2
7월 25
653
1
3월 24
1685
0
10월 22
1977
3
10월 23
5296
1
1월 25
1660