Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3987 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Get value from list/dict in Qweb แก้ไขแล้ว
1
ม.ค. 21
12081
t-att-href url get error แก้ไขแล้ว
2
เม.ย. 23
8580
3
ก.ย. 20
4497
2
เม.ย. 20
6275
4
มี.ค. 20
4674