Jquery 如何在pos_餐厅模块中自定义pos收据?

Jquery 如何在pos_餐厅模块中自定义pos收据?,jquery,odoo,odoo-10,point-of-sale,Jquery,Odoo,Odoo 10,Point Of Sale,有两个报告,“BillReceipt”和“PosTicket”。一个在POS_餐厅,另一个在point_of_销售模块。BillReceive在连接POSbox的情况下工作,Posticket在没有POSbox的情况下工作。 我继承了PosTicket并对其进行了定制,它工作得很好,但当我连接POSbox时,BillReceipt就会出现 插件/销售点/static/src/xml/pos.xml,PosTicket addons/pos_restaurant/static/src/xml/pr

有两个报告,“BillReceipt”和“PosTicket”。一个在POS_餐厅,另一个在point_of_销售模块。BillReceive在连接POSbox的情况下工作,Posticket在没有POSbox的情况下工作。 我继承了PosTicket并对其进行了定制,它工作得很好,但当我连接POSbox时,BillReceipt就会出现

插件/销售点/static/src/xml/pos.xml,PosTicket

addons/pos_restaurant/static/src/xml/printbill.xml,BillReceive

我想通过使用t-name=“BillReceivement”继承模板,在POS餐厅模块中自定义收据




电话: 大桶: -------------------------------- 由

折扣:% x -------- 小计 -------- 全部的

折扣



我打算将当前的收据格式完全替换为我在POS模块中所做的格式,该模块在单击“付款”按钮后立即出现。
另外,是否可以在连接了POSbox的情况下使收据工作?

如果您希望继承Qweb模板报告,则可以通过以下方式执行:


在这里,您可以使用不同的
t-jquery
属性,还可以将值传递给字段
t-operation
同样地传递给您的需求。您可以通过此链接了解更多信息:


现在,如果您想要覆盖模板,那么您只需要在自定义模块中调用具有相同id的相同模板。这样模板就被覆盖了。

我该怎么做?覆盖模板。这是我继承模板覆盖模板的方式。您需要使用与基本模板相同的id,即
//自定义代码
这是您可以将基本模板覆盖到自定义模块中的方式。表标记似乎在此模板中不起作用,为什么?基本模板中没有任何
标记。如果你想添加,那么你也可以添加。
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

<t t-name="BillReceipt">
    <receipt align='center' width='40' value-thousands-separator='' >
        <t t-if='receipt.company.logo'>
            <img t-att-src='receipt.company.logo' />
            <br/>
        </t>
        <t t-if='!receipt.company.logo'>
            <h1><t t-esc='receipt.company.name' /></h1>
            <br/>
        </t>
        <div font='b'>
            <t t-if='receipt.shop.name'>
                <div><t t-esc='receipt.shop.name' /></div>
            </t>
            <t t-if='receipt.company.contact_address'>
                <div><t t-esc='receipt.company.contact_address' /></div>
            </t>
            <t t-if='receipt.company.phone'>
                <div>Tel:<t t-esc='receipt.company.phone' /></div>
            </t>
            <t t-if='receipt.company.vat'>
                <div>VAT:<t t-esc='receipt.company.vat' /></div>
            </t>
            <t t-if='receipt.company.email'>
                <div><t t-esc='receipt.company.email' /></div>
            </t>
            <t t-if='receipt.company.website'>
                <div><t t-esc='receipt.company.website' /></div>
            </t>
            <t t-if='receipt.header'>
                <div><t t-esc='receipt.header' /></div>
            </t>
            <t t-if='receipt.cashier'>
                <div class='cashier'>
                    <div>--------------------------------</div>
                    <div>Served by <t t-esc='receipt.cashier' /></div>
                </div>
            </t>
        </div>
        <br /><br />

        <!-- Orderlines -->

        <div line-ratio='0.6'>
            <t t-foreach='receipt.orderlines' t-as='line'>
                <t t-set='simple' t-value='line.discount === 0 and line.unit_name === "Unit(s)" and line.quantity === 1' />
                <t t-if='simple'>
                    <line>
                        <left><t t-esc='line.product_name' /></left>
                        <right><value><t t-esc='line.price_display' /></value></right>
                    </line>
                </t>
                <t t-if='!simple'>
                    <line><left><t t-esc='line.product_name' /></left></line>
                    <t t-if='line.discount !== 0'>
                        <line indent='1'><left>Discount: <t t-esc='line.discount' />%</left></line>
                    </t>
                    <line indent='1'>
                        <left>
                            <value value-decimals='3' value-autoint='on'>
                                <t t-esc='line.quantity' />
                            </value>
                            <t t-if='line.unit_name !== "Unit(s)"'>
                                <t t-esc='line.unit_name' /> 
                            </t>
                            x 
                            <value value-decimals='2'>
                                <t t-esc='line.price' />
                            </value>
                        </left>
                        <right>
                            <value><t t-esc='line.price_display' /></value>
                        </right>
                    </line>
                </t>
            </t>
        </div>

        <!-- Subtotal -->
        <t t-set='taxincluded' t-value='Math.abs(receipt.subtotal - receipt.total_with_tax) &lt;= 0.000001' />
        <t t-if='!taxincluded'>
            <line><right>--------</right></line>
            <line><left>Subtotal</left><right> <value><t t-esc="receipt.subtotal" /></value></right></line>
            <t t-foreach='receipt.tax_details' t-as='tax'>
                <line>
                    <left><t t-esc='tax.name' /></left>
                    <right><value><t t-esc='tax.amount' /></value></right>
                </line>
            </t>
        </t>

        <!-- Total -->

        <line><right>--------</right></line>
        <line size='double-height'>
            <left><pre>        TOTAL</pre></left>
            <right><value><t t-esc='receipt.total_with_tax' /></value></right>
        </line>
        <br/><br/>

        <!-- Extra Payment Info -->

        <t t-if='receipt.total_discount'>
            <line>
                <left>Discounts</left>
                <right><value><t t-esc='receipt.total_discount'/></value></right>
            </line>
        </t>
        <t t-if='taxincluded'>
            <t t-foreach='receipt.tax_details' t-as='tax'>
                <line>
                    <left><t t-esc='tax.name' /></left>
                    <right><value><t t-esc='tax.amount' /></value></right>
                </line>
            </t>
        </t>

        <!-- Footer -->
        <t t-if='receipt.footer_xml'>
            <t t-raw='receipt.footer_xml' />
        </t>

        <t t-if='!receipt.footer_xml and receipt.footer'>
            <br/>
            <t t-esc='receipt.footer' />
            <br/>
            <br/>
        </t>

        <br/>
        <div font='b'>
            <div><t t-esc='receipt.name' /></div>
            <div><t t-esc='receipt.date.localestring' /></div>
        </div>

    </receipt>
</t>

</templates>
<t t-extend="BillReceipt">
    <t t-jquery='place_where_you_want_to_do_chnage' t-operation='differet_operations'>
    </t>
</t>