0
我正在使用Odoo10,我想在POS收據中添加產品明細表,並添加另一個打印按鈕以僅打印明細表。 我遇到了麻煩,我不知道如何將事件添加到我的按鈕。這是我的模塊,請檢查我。如何在Odoo 10中添加自定義按鈕到POS收據
Qweb:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="point_of_sale_template" xml:space="preserve">
<t t-extend="PosTicket">
<t t-jquery='.pos-sale-ticket' t-operation='after'>
<div class="pos-sale-ticket-appended" style="clear:both; text-align: left; width: 300px; background-color: white; margin: 20px; padding: 15px; font-size: 14px;padding-bottom: 30px; display: inline-block;font-family: 'Inconsolata'; border: solid 1px rgb(220,220,220); border-radius: 3px; overflow: hidden;">
<div style="background: white; margin: 20px auto;">
<h4>Products Detail</h4>
<div style="display: inline-block">
<table class='receipt-orderlines' style="width: 300px; border">
<colgroup>
<col width='50%' />
<col width='25%' />
<col width='25%' />
</colgroup>
<tr>
<th>Name</th>
<th>SKU</th>
<th>Cost</th>
</tr>
<tr t-foreach="orderlines" t-as="orderline">
<t t-log="orderline.get_product().cost_method" />
<t t-log="orderline.get_product().property_cost_method" />
<td>
<t t-esc="orderline.get_product().display_name"/>
</td>
<td>
<t t-esc="orderline.get_product().default_code"/>
</td>
<td>
<t t-esc="orderline.get_product().standard_price"/>
</td>
</tr>
</table>
<br />
</div>
</div>
</div>
</t>
</t>
<t t-extend="ReceiptScreenWidget">
<t t-jquery='div.receipt-screen.screen > div > div.centered-content.touch-scrollable > div.button.print' t-operation="after">
<div class="button print-detail">
<i class='fa fa-print'></i> Print Detail
</div>
</t>
</t>
</templates>
JS:我只是延長POS模型,並添加standard_price場
odoo.define('pos_receipt_extend', function (require) {
"use strict";
var $ = require('jquery');
// Add cost field to product model
var models = require('point_of_sale.models');
models.load_fields('product.product', 'standard_price');
var screens = require('point_of_sale.screens');
});
清單的.py
# -*- coding: utf-8 -*-
{
"name": "Pos extend Receipt",
"summary": "pos_es_receipt",
"version": "8.0.1.0",
"category": "Point Of Sale",
"website": "http://www.difusionvisual.com",
"author": "Difusión Visual",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"base",
"point_of_sale",
],
"qweb": [
'static/src/xml/receipt.xml'
],
"data":["views/pos_es_receipt.xml"]
}
請告訴我如何添加一個動作的onClick上打印詳細按鈕
我試過這個。但它在調試模式下工作。在正常模式下,它不在pos收據中打印。 –