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

Hello there,


I have just upgraded from V16.0 to 17.2.

I used to extract the pdf file from a order by getting the 'message_main_attachment_id' value on sale.order.


This field is no longer present in V17.2, would you know how to get this information from ?


Regards,

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

Thank you for your answers, but I'm lost.

Maybe I should have told you that I'm on Odoo online

아바타
취소
베스트 답변

The suggestion from cyborg is not ok, since v17.0 when inheriting mail.thread , it will not have feature call "main_attachment" where we will have field "message_main_attachment_id".
So if you want to add it back just inherit "mail.thread.main.attachment" for sale.order model

아바타
취소
베스트 답변

Hi,


In Odoo v17, if the message_main_attachment_id field has been removed, you can recreate it in a custom module. Below is the corrected and complete code to add the message_main_attachment_id field to the sale.order model and update the form view to include this field.


Python code:


# -- coding: utf-8 --

from odoo import _, fields, models



class SaleOrder(models.Model):

    _inherit = ‘sale.order'


    message_main_attachment_id = fields.Many2one(

        string="Main Attachment",

        comodel_name='ir.attachment',

        copy=False)


XML code:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_sale_order_form" model="ir.ui.view">
<field name="name">view.sale.order.form</field>
<field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_chatter')]" position="before">
                <div class="o_attachment_preview"/>
            </xpath>
        </field>
    </record>
</odoo>


Hope it helps.


아바타
취소
관련 게시물 답글 화면 활동
1
10월 24
1525
5
10월 24
18672
3
7월 24
2361
1
5월 24
2868
0
1월 24
1319