首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何从销售订单打印POS回单?

如何从销售订单打印POS回单?
EN

Stack Overflow用户
提问于 2018-08-01 20:57:47
回答 1查看 1.3K关注 0票数 2

我需要打印具有相同产品数量等的销售订单的POS收据。

在销售订单中,我创建了一个“打印POS机receIpt”按钮。通过这个按钮,我想要触发一个打印带有销售订单行的收据的方法。

因此,我需要找到创建POS收据并将销售订单行值传递给它的方法。

那么在POS中打印收据是哪种方式,如何触发?它是models.js格式的吗

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-18 07:03:33

在这些Odoo版本中,POS机中打印的收据是由JavaScript制作的屏幕截图(实际上只有收据div)。但是您不能在Sale Order视图上使用此方法。

然而,还有另一种方法可以使用普通的Qweb报告将票证打印为PDF格式。如果你点击POS菜单,你会在左边空白处找到"Orders“菜单选项。您将在表单和列表视图的“打印”菜单下看到打印选项。

如果你进入point_of_sale模块,你会找到用Qweb语言编写的report_receipt.xml文件。您可以对其进行自定义,使其与sale.order模型一起工作。但考虑到纸张格式应该是point_of_sale.paperformat_posreceipt,您将在这些代码的底部找到指定的纸张格式:

<template id="report_receipt">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <div class="page">
                <div class="row">
                    <div class="col-xs-12 text-center">
                        <h2 t-esc="o.user_id.company_id.name"/>
                        <div t-field="o.partner_id"
                            t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
                        User: <span t-field="o.user_id"/><br/>
                        Date: <span t-field="o.date_order"/><br/>
                    </div>
                </div>

                <div class="row">
                </div>

                <table class="table table-condensed">
                    <thead>
                        <tr>
                            <th>Description</th>
                            <th class="text-right">Quantity</th>
                            <th class="text-right">Price</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr t-foreach="o.lines" t-as="line">
                            <td><span t-field="line.product_id"/></td>
                            <td class="text-right">
                                <t t-if="o.state != 'cancel' and o.statement_ids">
                                    <span t-field="line.qty"/>
                                </t>
                            </td>
                            <td class="text-right">
                                <t t-if="o.state != 'cancel' and o.statement_ids">
                                    <span t-esc="formatLang(net(line.id), currency_obj=res_company.currency_id)"/>
                                </t>
                                <t t-if="line.discount != 0.0">
                                    <span t-esc="line.discount"/>%
                                </t>
                            </td>
                        </tr>
                    </tbody>
                </table>

                <div class="row">
                    <div class="col-xs-12 pull-right">
                        <table class="table table-condensed">
                            <tr class="border-black">
                                <td><strong>Taxes</strong></td>
                                <td class="text-right">
                                    <strong t-esc="formatLang(o.amount_tax, currency_obj=res_company.currency_id)"/>
                                </td>
                            </tr>
                            <tr>
                                <td><strong>Total</strong></td>
                                <td class="text-right">
                                    <strong t-esc="formatLang(o.amount_total, currency_obj=res_company.currency_id)"/>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                <table class="table table-condensed">
                    <thead>
                        <tr>
                            <th>Payment Mode</th>
                            <th>Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr t-foreach="get_journal_amt(o)" t-as="d">
                            <td>
                                <span t-esc="d['name']"/>
                            </td>
                            <td>
                                <span t-esc="formatLang(d['amt'], currency_obj=res_company.currency_id)"/>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </t>
    </t>
</template>

<report
    id="action_report_pos_receipt"
    string="Receipt"
    model="pos.order"
    report_type="qweb-pdf"
    name="point_of_sale.report_receipt"
    file="point_of_sale.report_receipt"
/>

<record id="action_report_pos_receipt" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="point_of_sale.paperformat_posreceipt"/>
</record>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51633901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档