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

Hi,

I am trying to create a new report in the sale.order object that only print if the shipment is done. To do that I need to acces to another object, the --> "stock.picking" and confirm that the field "state" is set to "done".


 I need to make and "if" statement and acces to this variable any place of the next .xml report that is the one who create the report:


<odoo>
<data>
<report id="report_albaran_template"
string="Imprimir albarán"
model="sale.order"
report_type="qweb-pdf"
name="print_albaran_from_confirmed_order.report_albaran_template"
print_report_name="'A- %s' % (object.name)"

/>

<template id="report_albaran_template_document" inherit_id="sale.report_saleorder_document">
<xpath expr="//h2[@class='mt16']" position="replace">
<h2 class="mt16">
<span t-if="doc.state in ['sent']">Albarán # </span>
<span t-field="doc.name"/>
</h2>
</xpath>
</template>

<template id="report_albaran_template" inherit_id="sale.report_saleorder">
<xpath expr='//t[@t-call="sale.report_saleorder_document"]' position="replace">
<t t-call="print_albaran_from_confirmed_order.report_albaran_template_document" t-lang="doc.partner_id.lang"/>
</xpath>
</template>

</data>
</odoo>

Do I need to do that from xml, as I saw in the "sale.order.state" with "order" and "quotation" labels for the report? or you suggest another way to do that?


How can I acces to another model? if the "doc" variable of the .xml is pointing to the "sale.order" object.


Thanks and regards,

 Amadeo

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 21
12097
2
thg 4 23
8581
3
thg 9 20
4497
2
thg 4 20
6279
4
thg 3 20
4683