Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
136 Widoki

I've added x_market_price as a new model & field and it successfully showing in product adding template as market price. Then I want to add this market unit price to the POS receipt before our unit price, qty and amount. I don't want to see it on POS interface or another places. only see on the product adding interface and POS receipt. I don't want any custom addon & I want to create it as new custom receipt design. My problem is add this market price to the custom POS receipt design code and additionally I want to add "Your Profit" (=Total market price - Total our price) after the Total amount. This is my customized code but it isn't work correctly. all others are working. I want to develop this market price section.


        <div class="pos-receipt">

            <t t-if="env.services.pos.config.logo">

                <img t-att-src="'data:image/png;base64,' + env.services.pos.config.logo"

                     alt="Logo" class="pos-receipt-logo"/>

                <br/>

             </t>

            <div class="pos-receipt-contact">

                <t t-if="env.services.pos.company.name">

                    <div><t t-esc="env.services.pos.company.name" /></div>

                </t>

                <t t-if="env.services.pos.company.phone">

                    <div>Tel:<t t-esc="env.services.pos.company.phone" /></div>

                </t>

                <t t-if="env.services.pos.company.vat">

                    <div><t t-esc="env.services.pos.company.vat_label"/>:<t t-esc="env.services.pos.company.vat" /></div>

                </t>

                <t t-if="env.services.pos.company.email">

                    <div><t t-esc="env.services.pos.company.email" /></div>

                </t>

                <t t-if="env.services.pos.company.website">

                    <div><t t-esc="env.services.pos.company.website" /></div>

                </t>

                <t t-if="props.receipt.headerData.header">

                    <t t-out="props.receipt.headerData.header" />

                </t>

                <t t-if="props.receipt.headerData.cashier">

                    <div class="cashier">

                        <div>--------------------------------</div>

                        <div>Served by <t t-esc="props.receipt.headerData.cashier" /></div>

                    </div>

                </t>

            </div>

            <br/>

            <t t-if="props.receipt.headerData.header">

                <div style='text-align:center; font-size:13px'>

                    <t t-esc="props.receipt.headerData.header" />

                </div>

                <br />

            </t>

            <div>

                <table class='receipt-orderlines' style="font-size:15px; border-style:double;

                 border-left:none; border-right:none; border-bottom:none; width:100%;">

                    <colgroup>

                        <col width='31%' />

                        <col width='19%' />

                        <col width='18%' />

                        <col width='12%' />

                        <col width='20%' />

                    </colgroup>

                    <tr style="border-bottom:1px dashed black;">

                        <th style="text-align:left;">භාණ්ඩය</th>

                        <th style="text-align:right;">වෙළඳ මිල</th>

                        <th style="text-align:right;">අපේ මිල</th>

                        <th style="text-align:right;">Qty</th>

                        <th style="text-align:right;">එකතුව</th>

                    </tr>

                    <t t-if="props.order and props.order.length and props.order and props.order.pos and props.order.pos.mainScreen and props.order.pos.mainScreen.props and props.order.pos.mainScreen.props.order and props.order.pos.mainScreen.props.order.orderlines and props.order.pos.mainScreen.props.order.orderlines.length">

                        <t t-if="props.order.pos.mainScreen.props">

                            <tr t-foreach="props.order.pos.mainScreen.props.order.orderlines" t-as="orderline" t-key="index_orderlines">

                                <td style="padding-top:1%; padding-bottom:1%; text-align:left;">

                                    <t t-esc="orderline.productName"/>

                                    <t t-if="orderline.get_discount() > 0">

                                        <div style="font-size:12px; font-style:italic; color:#808080;">

                                            <t t-esc="orderline.get_discount()"/>% discount

                                        </div>

                                    </t>

                                    <t t-if="orderline.customerNote">

                                        <div style="font-size:14px;" t-esc="orderline.customerNote"/>

                                    </t>

                                </td>

                               

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="env.utils.formatCurrency(orderline.x_market_price)"/>

                                </td>

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="env.utils.formatCurrency(orderline.unit_price)"/>

                                </td>

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="orderline.get_quantity_str_with_unit()"/>

                                </td>

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>

                                </td>

                            </tr>

                        </t>

                    </t>

                    <t t-else="">

                        <t t-if="props.orderlines and props.orderlines.length">

                            <tr t-foreach="props.orderlines" t-as="orderline" t-key="orderline_index">

                                <td style="padding-top:1%; padding-bottom:1%; text-align:left;">

                                    <t t-esc="orderline.productName"/>

                                    <t t-if="orderline.discount > 0">

                                        <div style="font-size:12px; font-style:italic; color:#808080;">

                                            <t t-esc="orderline.discount"/>% discount

                                        </div>

                                    </t>

                                    <t t-if="orderline.customerNote">

                                        <div style="font-size:14px;" t-esc="orderline.customerNote"/>

                                    </t>

                                </td>

                               

                               

                                <!--

                                <td style="text-align:right; font-size:14px;">

                                    <t t-if="orderline.x_market_price">

                                    <t t-esc="env.utils.formatCurrency(orderline.x_market_price)"/>

                                    </t>

                                    <t t-else="orderline.unitPrice">

                                        0.00

                                    </t>

                                </td>

                                -->

                               

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="orderline.x_market_price or orderline.unitPrice"/>

                                </td>

                               

                               

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="orderline.unitPrice"/>

                                </td>

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="orderline.qty"/>

                                </td>

                                <td style="text-align:right; font-size:14px;">

                                    <t t-esc="orderline.price"/>

                                </td>

                            </tr>

                        </t>

                    </t>


                </table>

            </div>

            <div style="padding-top:6px;">

                <t t-set='taxincluded' t-value='Math.abs(props.receipt.amount_total - props.receipt.total_with_tax) &lt;= 0.000001' />

                <t t-if='!taxincluded'>

                   

                    <div style="font-weight:700; font-size:14px; border-top:1.5px dashed;">

                        <span style="margin-left:40%;">මුළු වටිනාකම : </span>

                        <span t-esc='env.utils.formatCurrency(props.data.amount_total)' class="pos-receipt-right-align"/>

                    </div>

                   

                    <div style="font-weight:700; font-size:14px; border-top:1.5px dashed;">

                        <span style="margin-left:40%;">ඔබ ලැබූ ලාභය: </span>

                        <span t-esc='env.utils.formatCurrency(props.data.market_total - props.data.amount_total)' class="pos-receipt-right-align"/>

                    </div>

    

                </t>

                           </div>



            <div class='before-footer' />

            <br/>

            <!-- Footer -->

            <div class="pos-receipt-order-data">

                <div><t t-esc="props.receipt.name" />

            </div>

            <t t-if="props.receipt.date">

                <div><t t-esc="props.receipt.date" /></div>

            </t>

            <t t-else="">

                <div><t t-esc="props.receipt.date" /></div>

            </t>

            </div>

            <br/>

            <div style="font-size:14px; text-align:center;">

                ස්තූතියි! නැවත එන්න!!!

            </div>

        </div>



I kindly request you to see this and try to develop this code without errors... And provide me a step by step process to fix this problem. 

Thank you very much

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
paź 25
3
2
paź 25
5634
2
paź 25
492
2
paź 25
655
1
paź 25
658