Hỏi Đáp

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Làm thế nào để tùy chỉnh biên lai cho điểm bán hàng

Ảnh đại diện
Bùi Chí Thành

Mình thấy các bên chạy ODOO tùy chỉnh được bill mặc định ở point of sale mà lần mò mãi không biết chỉnh ở chỗ nào.
Vui lòng chỉ giúp mình:
_ Chỉnh biên lai mặc định: chèn logo, chỉnh size, font, text.. giống như mẫu trong file đính kèm
_ Hướng dẫn cách chỉnh biên lai cả bản PDF, nếu có thể làm cả HTML thì càng tốt ạ.

Cảm ơn nhiều

Screenshot

Ảnh đại diện
Huỷ bỏ
1 Trả lời
0
Ảnh đại diện
Coffee One
Best Answer

Với Odoo thì cái gì chả tuỳ chỉnh được bác. Một số phần thì tuỳ chỉnh ngay trong giao diện Odoo được, một số phần phức tạp thì cần tuỳ chỉnh bằng module bổ sung. Tuỳ chỉnh cái biên lai của PoS thì không phức tạp nhưng do cơ chế đặc thù của PoS nên việc tuỳ chỉnh biến lai buộc phải viết ở module. Bác cần điều chỉnh lại cho phù hợp với mẫu bên bác.
Share với bác đoạn code xml mà các bác ERPOnline làm cho công ty mình

<templates id="toCoffeeOneReceiptTemplate" xml:space="preserve">
	<t t-extend="PosWidget" >
        <t t-jquery="img.pos-logo" t-operation="replace">
        		<img class="pos-logo" t-att-src="widget.session.url('/web/binary/company_logo')"/>
    	</t>
    </t>
    <t t-name="PosTicket">
        <div class="pos-sale-ticket">
            <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
                Date.CultureInfo.formatPatterns.longTime)"></t> <t t-esc="order.get('name')"></t></div>
            <br />
            <t t-if='widget.pos.company.logo'>
                <div id="company_logo" class="pos-center-align">
                	<img t-att-src="'data:image/png;base64,' + widget.pos.company.logo" />
                </div>
            </t>
            <t t-esc="widget.pos.company.name"></t><br />
            Phone: <t t-esc="widget.pos.company.phone || ''"></t><br />
            User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"></t><br />
            Customer: <t t-esc="customer_name"></t><br />
            Shop: <t t-esc="widget.pos.shop.name"></t><br />
            <br />
            <t t-if="widget.pos.config.receipt_header">
                <div style='text-align:center'>
                    <t t-esc="widget.pos.config.receipt_header" ></t>
                </div>
                <br />
            </t>
            <table>
                <colgroup>
                    <col width='50%' />
                    <col width='25%' />
                    <col width='25%' />
                </colgroup>
                <tr t-foreach="orderlines" t-as="orderline" class="spaceUnder">
                	<t t-set="discount" t-value="0"></t>
                	<t t-set="raw_qty" t-value="'' + orderline.get_quantity()"></t>
                	
                	<t t-if="orderline.get_discount() > 0">
                		<t t-set="discount" t-value="orderline.get_discount()"></t>
                	</t>
                    <td style="vertical-align: top;">
                        <t t-esc="orderline.get_product().display_name"></t>
                         <t t-if="discount > 0">
                            <div class="pos-disc-font">
                                With a <t t-esc="discount"></t>% discount
                            </div>
                        </t>
                    </td>
                    <td class="pos-left-align" style="vertical-align: bottom;">
                        	<t t-esc="raw_qty + ' ' + orderline.get_unit().name"></t><br />
                        <t t-if="discount > 0">
                        	<t t-esc="widget.format_currency_no_currency_symbol(orderline.price - orderline.price * discount/100)"></t>
                        </t>
                        
                        <t t-if="discount == 0">
                        	<t t-esc="widget.format_currency_no_currency_symbol(orderline.price)"></t>
                        </t>
                    </td>
                    <td class="pos-right-align" style="vertical-align: bottom;">
                        <t t-esc="widget.format_currency_no_currency_symbol(orderline.get_display_price())"></t>
                    </td>
                </tr>
            </table>
            <br />
            <table>
                <tr>
                    <td>Subtotal:</td>
                    <td class="pos-right-align">
                        <t t-esc="widget.format_currency(order.getTotalTaxExcluded())"></t>
                    </td>
                </tr>
                <t t-foreach="order.getTaxDetails()" t-as="taxdetail">
                    <tr>
                        <td><t t-esc="taxdetail.name" ></t></td>
                        <td class="pos-right-align">
                            <t t-esc="widget.format_currency(taxdetail.amount)" ></t>
                        </td>
                    </tr>
                </t>
                <tr class="spaceUnder">
                    <td>Discount:</td>
                    <td class="pos-right-align">
                        <t t-esc="widget.format_currency(order.getDiscountTotal())"></t>
                    </td>
                </tr>
                <tr class="emph">
                    <td>Total:</td>
                    <td class="pos-right-align">
                        <t t-esc="widget.format_currency(order.getTotalTaxIncluded())"></t>
                    </td>
                </tr>
            </table>
            <br />
            <table>
                <tr t-foreach="paymentlines" t-as="line">
                    <td>
                        <t t-esc="line.name"></t>
                    </td>
                    <td class="pos-right-align">
                        <t t-esc="widget.format_currency(line.get_amount())"></t>
                    </td>
                </tr>
            </table>
            <br />
            <table>
                <tr class="emph change">
                	<td>Change:</td>
                	<td class="pos-right-align">
                    	<t t-esc="widget.format_currency(order.getChange())"></t>
                    </td>
                </tr>
            </table>
            <t t-if="widget.pos.config.receipt_footer">
                <br />
                <div style='text-align:center'>
                    <t t-esc="widget.pos.config.receipt_footer" ></t>
                </div>
            </t>
        </div> 
    </t>
</templates>

Nói chung, nó không dễ như sửa giao diện Tree, List, Form, Graph của Odoo (có thể làm ngay trong gia diện Odoo). PoS có đặc trưng riêng.
2 Bình luận
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
ViindooBot
-

Cảm ơn sự nhiệt tình của bác, nhưng vấn đề là vào đâu để chỉnh cái này ạ @@.

Ảnh đại diện
Trần Ngọc Tuấn
-

+1 Like cho Coffee One, rất cộng đồng ^_^

@Mike, cái này là viết module thêm chứ không sửa ở trong UI được. View nào bạn cũng sửa được ở trong UI của Odoo nhưng riêng mấy cái view của PoS thì bó tay. Chỉ có thể override chúng bằng custom module phát triển thêm.
Bạn khích Coffee One share... cả module đê ^_^

Trả lời của Bạn

Vui lòng đảm bảo câu trả lời của bạn có liên quan và giải đáp đúng nội dung câu hỏi. Nếu muốn bình luận về câu hỏi hoặc câu trả lời, hãy sử dụng công cụ Bình luận. Lưu ý, bạn có thể thay đổi nội dung trả lời thay vì trả lời lại 02 lần cho cùng một câu hỏi. Đồng thời bạn có thể nhấn nút để bầu chọn câu hỏi / câu trả lời tốt nhất.