odoo 16 打印发票的方法

问题描述 投票:0回答:1

我编写了一种过帐发票的方法,如下所示:

`def print_invoice(self):

        _logger.info('-#-#-#-#--#-#-#-in print_invoice')

        line_array = []

        对于 self.ks_paketareale 中的 ar:

            val = (0, 无, {

                'product_id': ar.ks_areal.id,

                '名称': ar.name,

                '数量': ar.ks_anzahl_behandlung,

                'price_unit': ar.ks_areal.list_price,

                'price_subtotal': ar.ks_areal.list_price * ar.ks_anzahl_behandlung,

            })

            line_array.append(val)

        iid = self.env['account.move'].create({

                'move_type': 'out_invoice',

                '发票日期': fields.Date.context_today(self),

                'partner_id': self.partner_id.id,

                #'currency_id': self.currency_id.id,

                'amount_total': self.ks_rabattpreis,

                'invoice_line_ids': line_array,

            },

     )

        iid.action_post()

        操作 = iid.action_invoice_print()

        action.update({'close_on_report_download': True})`

创建发票工作,创建的发票已过帐。

但是 iid.action_invoice_print() 的调用不起作用。什么都没发生。 我期望开始下载发票,因为在该方法中 _print_document 在accout_move 中调用action_invoice_print 方法。 出什么问题了?感谢您的帮助

覆盖action_post和action_print_invoice

printing invoice odoo-16
1个回答
0
投票

哇,谢谢 Levizar,这是关键的线索。抱歉我忘记了并且没有看到它

© www.soinside.com 2019 - 2024. All rights reserved.