Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1793 Zobrazení

i have customized my odoo receipt and it works great in a normal cycle of pos but if i want to reprint any order that is paid using orders at the top of pos . it didnt show the complete information.
https://drive.google.com/file/d/1C-pYxlBtSbcI1KRZWpnYemE04VzH1LWW/view?usp=sharing
above link is this is my actual receipt view
this is how it show when i access it from order at the top in odoo 16

https://drive.google.com/file/d/1tzYTLWxKczfExi3b1XkTMkQQLVR_BLHI/view?usp=sharing

it didnt pick up the orderlines , customer(name,number,address) lastly the subtotal,delivery charges before the GST tax line in the bottom.

this is my xml code with which i am working in the comment.


Avatar
Zrušit
Autor

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- Define a new template 'AddonsRecipt' based on the 'point_of_sale.OrderReceipt' template -->
<t t-name="AddonsReceipt" t-inherit="point_of_sale.OrderReceipt"
t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('orderlines')]" position="replace">
<!-- Divider line -->
<div class="order-line-divider" style="text-align: center;">
<hr style="width: 100%; border: 1px solid black; margin-top: 15px; margin-bottom: 15px" />
</div>
<t t-set="total_quantity" t-value="0"/>
<div class="orderlines" >
<t t-foreach="receipt.orderlines" t-as="line" t-key="line.id">
<t t-set="total_quantity" t-value="total_quantity + line.quantity"/>
<div style="padding-bottom: 10px;">
<!-- Add padding here -->
<t t-if="isSimple(line)">
<!-- Display the product name and price-->
<div style="font-weight: bold;">
<div style="display: flex; justify-content: space-between;">
<div style="flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<span t-esc="Math.round(line.quantity * Math.pow(10, env.pos.dp['Product Unit of Measure'])) / Math.pow(10, env.pos.dp['Product Unit of Measure'])"/>
x
<t t-esc="line.product_name_wrapped[0]"/>
</div>
<div style="flex-shrink: 0;">
<span t-esc="env.pos.format_currency_no_symbol(line.price_display)" class="price_display"/>
</div>
</div>
<div style="margin-left: 22px;">
<WrappedProductNameLines line="line"/>
</div>
</div>
</t>
<t t-else="">
<div style="font-weight: bold;">
<div style="display: flex; justify-content: space-between;">
<div style="flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<span t-esc="Math.round(line.quantity * Math.pow(10, env.pos.dp['Product Unit of Measure'])) / Math.pow(10, env.pos.dp['Product Unit of Measure'])"/>
x
<t t-esc="line.product_name_wrapped[0]"/>
</div>
<div style="flex-shrink: 0;">
<span t-esc="env.pos.format_currency_no_symbol(line.price_display)" class="price_display"/>
</div>
</div>
<div style="margin-left: 22px;">
<WrappedProductNameLines line="line"/>
</div>
</div>
<!-- Check if the discount policy is set to 'without_discount' and the price has changed from the list price -->
<t t-if="line.display_discount_policy == 'without_discount' and line.price != line.price_lst">
<div class="pos-receipt-left-padding">
<t t-esc="env.pos.format_currency_no_symbol(line.price_lst)"/>
->
<t t-esc="env.pos.format_currency_no_symbol(line.price)"/>
</div>
</t>
<t t-elif="line.discount !== 0">
<div class="pos-receipt-left-padding">
<t t-if="env.pos.config.iface_tax_included === 'total'">
<t t-esc="env.pos.format_currency_no_symbol(line.price_with_tax_before_discount)"/>
</t>
<t t-else="">
<t t-esc="env.pos.format_currency_no_symbol(line.price)"/>
</t>
</div>
</t>
<!--Display the discount amount-->
<t t-if="line.discount !== 0">
<div class="pos-receipt-left-padding">
Discount: <t t-esc="line.discount"/>%
</div>
</t>
</t>
<t t-if="line.customer_note">
<div class="pos-receipt-left-padding pos-receipt-customer-note-left-align" style="font-style: italic; margin-left: -7px;">
<t t-esc="'&quot;' + line.customer_note + '&quot;'"/>
</div>
</t>
<!-- Show addon products in Receipt -->
<tr t-foreach="props.order.orderlines" t-as="orderline"
t-key="orderline_index">
<t t-if="line.orderline_id == orderline.id">
<tr t-foreach="orderline.addon_items"
t-as="addon_item" t-key="addon_item_index">
<div class="pos-receipt" >
<span
t-esc="addon_item.addon_name"
style="margin-left: 22px;"/>
<span style="margin-left:8px"
class="pos-receipt-right-align">
<span t-esc="env.pos.format_currency_no_symbol(addon_item.addon_price_without)"/>
</span>
</div>
</tr>
</t>
</tr>
</div> <!-- Close padding div here -->
</t>
</div>
<!-- Divider line -->
<div class="order-line-divider" style="text-align: center;">
<hr style="width: 100%; border: 1px solid black;" />
</div>
<br></br>
<div style="text-align: center;">
<span t-esc="total_quantity"/> Items Ordered.
</div>
<br></br>
</xpath>
<xpath expr="//t[@t-if='!isTaxIncluded']" position="before">
<t t-if="receipt.delivery_line.length > 0">
<t t-if="receipt.delivery_line[0].price">
<div class="pos-receipt-amount-left-align">
Subtotal
<span t-esc="env.pos.format_currency_no_symbol(receipt.total_without_tax - receipt.delivery_line[0].price)"
class="pos-receipt-right-align"/>
</div>
<div class="pos-receipt-amount-left-align">
Delivery Charges<span t-esc="env.pos.format_currency_no_symbol(receipt.delivery_line[0].price)" class="pos-receipt-right-align"/>
</div>
</t>
</t>
</xpath>
<xpath expr="//t[@t-if='!isTaxIncluded']" position="replace">
<t t-if="!isTaxIncluded">
<t t-if="receipt.table != 'DELIVERY'">
<div>Subtotal<span t-esc="env.pos.format_currency_no_symbol(receipt.subtotal)" class="pos-receipt-right-align"/></div>
</t>
<t t-foreach="receipt.tax_details" t-as="tax" t-key="tax.tax.id">
<div class="responsive-price">
<t t-esc="tax.name" />
<span t-esc='env.pos.format_currency_no_symbol(receipt.total_with_tax-receipt.subtotal)' class="pos-receipt-right-align"/>
</div>
</t>
</t>
</xpath>
<xpath expr="//div[hasclass('pos-receipt-amount')][contains(text(), 'Grand Total')]" position="replace">
<div class="pos-receipt" style="text-align: center;">
<hr style="width: 100%; border: 1px solid black; " />
</div>
<div class="pos-receipt-amount-left-align">
Total
<span t-esc="env.pos.format_currency_no_symbol(receipt.total_with_tax)" class="pos-receipt-right-align"/>
</div>
</xpath>
<xpath expr="//t[@t-if='receipt.total_rounded != receipt.total_with_tax']" position="replace">
<t t-if="receipt.total_rounded != receipt.total_with_tax">
<div class="pos-receipt-amount-left-align">
Rounding
<span t-esc='env.pos.format_currency_no_symbol(receipt.rounding_applied)' class="pos-receipt-right-align"/>
</div>
<div class="pos-receipt-amount-divider" style="text-align: center;">
<hr style="width: 100%; border: 1px solid black;" />
</div>
<div class="pos-receipt-amount-left-align" style="font-weight: bold;">
Payable
<span t-esc='env.pos.format_currency_no_symbol(receipt.total_rounded)' class="pos-receipt-right-align"/>
</div>
</t>
<br></br>
<div class="pos-receipt-amount-left-align receipt-change">
Change
<span t-esc="env.pos.format_currency_no_symbol(receipt.change)" class="pos-receipt-right-align"/>
</div>
</xpath>

<!--HIDE FIELDS-->
<xpath expr="//div[@class='pos-receipt-contact']/following-sibling::br[1]" position="attributes">
<attribute name="style">display:none;</attribute>
</xpath>
<xpath expr="//div[@class='pos-receipt-contact']/following-sibling::br[2]" position="attributes">
<attribute name="style">display:none;</attribute>
</xpath>
<xpath expr="//div[@class='pos-receipt-right-align' and text()='--------']" position="replace">
</xpath>
<xpath expr="//t[@t-esc='receipt.name']" position="replace">
</xpath>
<xpath expr="//t[@t-esc='receipt.date.localestring']" position="replace">
</xpath>
<xpath expr="//t[@t-esc='receipt.date.validation_date']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.company.vat']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.table']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.table and receipt.customer_count']" position="replace">
</xpath>
<xpath expr="//t[@t-foreach='receipt.paymentlines']" position="replace">
</xpath>
<xpath expr="//div[contains(@class, 'pos-receipt-amount receipt-change')]" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.cashier']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.company.contact_address']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.delivery_line.length>0']" position="replace">
</xpath>
<xpath expr="//t[@t-if='receipt.company.logo']" position="replace">
</xpath>

<!--Contact-->
<xpath expr="//t[@t-if='!receipt.header_html and receipt.header']" position="before">
<t t-if="receipt.company.logo">
<img class="pos-receipt-logo" t-att-src="receipt.company.logo" alt="Logo"/>
</t>
</xpath>
<xpath expr="//div[contains(@style, 'white-space:pre-line') and not(contains(@style, 'line-height'))]" position="attributes">
<attribute name="style">white-space:pre-line; line-height: 1.5; font-size: 14px;</attribute>
</xpath>
<xpath expr="//div[hasclass('pos-receipt-contact')]/div[contains(., 'Customer :')]" position="attributes">
<attribute name="style">text-align: left; font-size: 14px; line-height: 1.5;</attribute>
</xpath>
<xpath expr="//div[hasclass('pos-receipt-contact')]/div[contains(., 'Delivery Address :')]" position="attributes">
<attribute name="t-if">receipt.table == 'DELIVERY'</attribute>
<attribute name="style">text-align: left; font-size: 14px; line-height: 1.5;</attribute>
</xpath>
<xpath expr="//div[hasclass('pos-receipt-contact')]/div[contains(., 'Phone :')]" position="attributes">
<attribute name="t-if">receipt.table == 'DELIVERY'</attribute>
<attribute name="style">text-align: left; font-size: 14px; line-height: 1.5;</attribute>
</xpath>
<xpath expr="//t[@t-if='!receipt.header_html and receipt.header']" position="after">
<br></br>
<div class="flex-container" style="display: flex; justify-content: space-between; margin-top: 20px;">
<div class="table-info" style="text-align: left; font-weight: bold; font-size: 15px; line-height: 1.5;">
<t t-if="receipt.table">
<t t-esc="receipt.table" />
</t>
<t t-foreach="receipt.paymentlines" t-as="line" t-key="line.cid">
<div>
<t t-esc="line.name" />
</div>
</t>
<br></br>
</div>
<div class="pos-receipt-order-data" style="text-align: right; font-size: 13px;">
<t t-if="receipt.date.localestring">
<div><t t-esc="props.order.get_custom_formatted_date(receipt.date.localestring)"/></div>
</t>
<t t-else="">
<div><t t-esc="props.order.get_custom_formatted_date(receipt.date.validation_date)" /></div>
</t>
<div><t t-esc="receipt.name.replace('Order ', 'Order ID: ')" /></div>
<div>Order Taker:
<t t-if="receipt.floor">
<t t-esc="receipt.floor" />
</t>
</div>
</div>
<br></br>
</div>
</xpath>
</t>
</templates>

Related Posts Odpovědi Zobrazení Aktivita
2
dub 22
3486
1
pro 24
2166
0
srp 24
1764
1
srp 24
2793
0
čvc 24
1404