Ich verwende Odoo10, möchte eine Produktdetailtabelle in POS Receip hinzufügen und auch eine weitere Druckschaltfläche hinzufügen, um nur die Detailtabelle zu drucken. Ich habe Probleme, ich weiß nicht, wie ich meiner Schaltfläche ein Ereignis hinzufügen kann. Hier ist mein Modul, bitte überprüfen Sie für mich.So fügen Sie eine benutzerdefinierte Schaltfläche zu POS-Empfang in Odoo 10 hinzu
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: Ich habe pos Modell erweitern und standard_price Feld
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');
});
manifest 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"]
}
hinzufügen
Bitte sagen Sie mir, wie eine Aktion onClick auf die Schaltfläche Drucken Details
Ich habe das versucht. aber es funktioniert im Debug-Modus. Im normalen Modus ist das Feld nicht in POS-Empfang gedruckt. –