Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1901 Lượt xem

Hi to all
I have an isuee in my export module

I add one HTML field to invoice in odoo 16 community and show that field in Tree but when we got export tag is showing.
how can I solve?



adding field

 memo = fields.Html(string='Memo', default= "Memo" , readonly=False, tracking=True)


show in Tree report-correct

                                   


this part added to show in invoice print

            

 

      

 

       

 




Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello

alireza riazi,


To add the html field in the qweb report here i have mention all the steps for that


step1:- Add the new field in in the existing form view like this i have also attached the image for code

// Code1 in Comment//



step2:- Inherit the view and add the field puth the "widget="html"" in the field in the form view like this  i have also attached the image


// Code2 in comment//


   

step3:- create the report action and add the template for the report and mention that html field name which you want to print the report here i have attached the code and image for that


//Code 3 in Comment//




step4:- put you file in the menifest like this



Hope this helps.

   

If you need any help in customization feel free to contact us.

Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ

Code 1 :

class SaleOrderInherit(models.Model):
"""Inherited IrConfigSettings for website first sale order discount"""
_inherit = 'sale.order'

customer_info = fields.Html(string="Customer Info")

Code 2 :

<record id="sale_order_inherited_view_form" model="ir.ui.view">
<field name="name">sale.order.inherited.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='signed_by']" position="after">
<field name="customer_info" widget="html"/>
</xpath>
</field>
</record>

Code 3 :

<!-- report action -->
<record id="action_report_product_product" model="ir.actions.report">
<field name="name">Sale Order</field>
<field name="model">sale.order</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">website_first_order_discount.report_product</field>
<field name="report_file">website_first_order_discount.report_product</field>
<field name="binding_model_id" ref="sale.model_sale_order"/>
<field name="binding_type">report</field>
</record>

<!-- Report Template -->
<template id="report_product">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure"/>
<h2>Product Report</h2>
<p><span t-field="o.customer_info"/></p>
</div>
</t>
</t>
</t>
</template>

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
1978
1
thg 7 25
1813
1
thg 5 25
2110
1
thg 4 25
2493
1
thg 2 25
1776