создать одну кнопку в вашей форме Вид
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<form string="Invoice">
<header>
<button name="invoice_print" string="Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
</header>
</form>
</field>
</field>
</record>
В вас Python Logic файл создать один метод, как показано ниже
@api.multi
def invoice_print(self):
""" Print the invoice and mark it as sent, so that we can see more
easily the next step of the workflow
"""
self.ensure_one()
return self.env['report'].get_action(self, 'account.report_invoice')
создать один Report.Xml, как показано ниже
<template id="report_invoice">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="moduleName.report_invoice_document" t-lang="o.partner_id.lang"/>
</t>
</t>
</template>
Спасибо jainik, но я не получаю, как дать конкретный счет-фактуру ID записи в качестве действия кнопки «Печать» в представлении формы (здесь я создаю разные динамические отчеты для разных записей). Есть ли возможность предоставить домен для параметра отчета для невидимости для определенных записей. – Sai1919
@ Sai1919 Можете ли вы подробнее рассказать о своей проблеме? –
Вы делаете домен на параметры печати или больше меню опций? –