跳至內容
選單
此問題已被標幟
464 瀏覽次數

I want to create 1 row if the invoice has similarities, for example if it has default_code 'Xirallic'. So combine several lines that have default_code 'Xirallic' in the table.



<table class="table table-condensed" style="border: 1px solid #000000; border-collapse: collapse; width: 100%; padding: 0;">

                                <thead>

                                    <tr>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 3%;">No</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 13%;">Kuantitas</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 12%;">Kode Barang</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 22%;">Nama Barang</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 8%;">Harga Satuan</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 6%;">Diskon I</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 6%;">Diskon II</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 6%;">Diskon III</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: center; width: 6%;">Diskon Tambahan</th>

                                        <th style="font-size: 14px; border: 1px solid #000000; text-align: right; width: 11%;">Jumlah</th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <t t-set="sequence" t-value="1 + page_idx * items_per_page"/>

                                    <t t-foreach="chunk" t-as="line">

                                        <tr>

                                            <td style="border: 1px solid; text-align: center; font-size: 14px;">

                                                <t t-esc="sequence"/>

                                                <t t-set="sequence" t-value="sequence + 1"/>

                                            </td>

                                            <td style="text-align: center; border: 1px solid; width: 17%;">

                                                <table style="width: 100%; border: none;">

                                                    <tr>

                                                        <td style="text-align: left; border: none; padding: 0; font-size: 14px;">

                                                            <t t-if="line.product_id.default_code">

                                                                <t t-if="line.product_id.default_code.startswith('327') and 'Xirallic' in line.product_id.default_code">

                                                                    <span><t t-esc="total_xirallic_327"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                                <t t-elif="line.product_id.default_code.startswith('257') and 'Xirallic' in line.product_id.default_code">

                                                                    <span><t t-esc="total_xirallic_257"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                                <t t-elif="'Standard' in line.product_id.default_code">

                                                                    <span><t t-esc="total_standard_quantity"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                                <t t-elif="'Pearl' in line.product_id.default_code">

                                                                    <span><t t-esc="total_pearl_quantity"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                                <t t-elif="'Special' in line.product_id.default_code">

                                                                    <span><t t-esc="total_special_quantity"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                                <t t-else="">

                                                                    <span><t t-esc="round(line.quantity)"/> <t t-esc="line.product_uom_id.name[:2]"/></span>

                                                                </t>

                                                            </t>

                                                            <t t-else="">

                                                                <p/>

                                                            </t>

                                                        </td>

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

                                                            <t t-if="line.product_id.default_code">

                                                                <t t-if="'Xirallic' in line.product_id.default_code">

                                                                    <p/>

                                                                </t>

                                                                <t t-elif="'Standard' in line.product_id.default_code">

                                                                    <p/>

                                                                </t>

                                                                <t t-elif="'Pearl' in line.product_id.default_code">

                                                                    <p/>

                                                                </t>

                                                                <t t-elif="'Special' in line.product_id.default_code">

                                                                    <p/>

                                                                </t>

                                                                <t t-else="">

                                                                    <span><t t-esc="line.product_id.default_code.split('-', 2)[-1]"/></span>

                                                                </t>

                                                            </t>

                                                            <t t-else="">

                                                                <p/>

                                                            </t>

                                                        </td>

                                                    </tr>

                                                </table>

                                            </td>

                                            <td style="border: 1px solid; text-align: left; width: 15%; font-size: 14px;">

                                                <t t-if="line.product_id.default_code">

                                                    <t t-if="'LTSET' in line.product_id.default_code">

                                                        <t t-esc="line.product_id.default_code[:8]"/>

                                                        <t t-set="child_products" t-value="env['product.product'].search([('parent_product', '=', line.product_id.id)])"/>

                                                        <t t-foreach="child_products" t-as="child_product">

                                                            <br/>

                                                            <span><t t-esc="child_product.default_code"/></span>

                                                        </t>

                                                    </t>

                                                    <t t-elif="line.product_id.default_code.startswith('257') and 'Xirallic' in line.product_id.default_code">

                                                        <span>257-Xirallic</span>

                                                    </t>

                                                    <t t-elif="line.product_id.default_code.startswith('327') and 'Xirallic' in line.product_id.default_code">

                                                        <span>327-Xirallic</span>

                                                    </t>

                                                    <t t-elif="'Standard' in line.product_id.default_code">

                                                        <span>257-Standard</span>

                                                    </t>

                                                    <t t-elif="'Pearl' in line.product_id.default_code">

                                                        <span>257-Pearl</span>

                                                    </t>

                                                    <t t-elif="'Special' in line.product_id.default_code">

                                                        <span>257-Special</span>

                                                    </t>

                                                    <t t-else="">

                                                        <t t-esc="line.product_id.default_code"/>

                                                    </t>

                                                </t>

                                                <t t-else="">

                                                    <p/>

                                                </t>

                                            </td>

                                            <td style="border: 1px solid; font-size: 14px;">

                                                <span t-field="line.product_id.name"/>

                                            </td>

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

                                                <span t-esc="'{:,.0f}'.format(line.price_unit)"/>

                                            </td>

                                            <td style="border: 1px solid; text-align: center; font-size: 14px;">

                                                <t t-if="line.multiple_discounts and len(line.multiple_discounts) &gt; 0">

                                                    <t t-set="discount_1" t-value="line.env['discount.discount'].browse(int(line.multiple_discounts[0]))"/>

                                                    <t t-if="doc.partner_id.id == 37191">

                                                        <t t-esc="'{:.1f}'.format(discount_1.amount) if discount_1 else '0'"/>%

                                                    </t>

                                                    <t t-elif="doc.partner_id.id != 37191">

                                                        <t t-esc="'{:.0f}'.format(discount_1.amount) if discount_1 else '0'"/>%

                                                    </t>

                                                </t>

                                                <t t-else="">

                                                    0%

                                                </t>

                                            </td>

                                            <td style="border: 1px solid; text-align: center; font-size: 14px;">

                                                <t t-if="line.multiple_discounts and len(line.multiple_discounts) > 1">

                                                    <t t-set="discount_2" t-value="line.env['discount.discount'].browse(int(line.multiple_discounts[1]))" />

                                                    <t t-esc="'{:.0f}'.format(discount_2.amount) if discount_2 else '0'" />%

                                                </t>

                                                <t t-else="">

                                                    0%

                                                </t>

                                            </td>

                                            <td style="border: 1px solid; text-align: center; font-size: 14px;">

                                                <t t-if="line.multiple_discounts and len(line.multiple_discounts) > 2">

                                                    <t t-set="discount_3" t-value="line.env['discount.discount'].browse(int(line.multiple_discounts[2]))" />

                                                    <t t-esc="'{:.0f}'.format(discount_3.amount) if discount_3 else '0'" />%

                                                </t>

                                                <t t-else="">

                                                    0%

                                                </t>

                                            </td>

                                            <td style="border: 1px solid; text-align: center; font-size: 14px;">

                                                <span t-esc="'{:.0f}'.format(line.discount_tambahan)"/>%

                                            </td>

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

                                                <span t-esc="'{:,.0f}'.format(line.price_total)"/>

                                            </td>

                                        </tr>

                                    </t>

                                </tbody>

                                <tfoot t-if="page_idx == page_count - 1">

                                    <tr>

                                        <td colspan="9" class="text-right">

                                            <b>Total</b>

                                        </td>

                                        <td style="border: 1px solid #000000; text-align: right; font-size: 14px;">

                                            <span t-esc="'{:,.0f}'.format(round(doc.amount_total, 2))"/>

                                        </td>

                                    </tr>

                                </tfoot>

                            </table>

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
12月 24
634
1
6月 24
1582
0
10月 24
1089
11
10月 24
26888
2
8月 24
34