Forum

Benvenuto!

Questo è il forum ufficiale dell'Associazione Odoo Italia. Dopo esserti registrato potrai partecipare ponendo domande o rispondendo a quelle esistenti. Non scordarti di compilare il tuo profilo e consultare le linee guida prima di iniziare a scrivere.

0

[10] Vendite - Stampa Report con subtotali

Avatar
M.Patos

Salve ragazzi, attivando la possibilità di personalizzare su preventivi e ordini di vendita i report con categorie, subtotali e interruzioni di pagina, automaticamente, la stampa prevede i subtotali se vengono valorizzate le opzioni sulle righe. Tuttavia, la stampa riporta alla fine delle righe comunque il totale complessivo e vorrei fare in modo che quando non ci sono opzioni attive stampi il totale complessivo ma quando ci sono i subtotali deve stampare solo quelli e non il totale complessivo.

A livello di report, vedo:

<t t-if="layout_category_size &gt; 1 or page_size &gt; 1" groups="sale.group_sale_layout">
                                <tr class="active">
                                    <td colspan="7" style="font-weight: bold; border-bottom: 1px solid black;">&amp;bull;
                                        <t t-esc="layout_category['name']"/>
                                    </td>
                                </tr>
                            </t>

                            <!-- Lines associated -->
                            <t t-foreach="layout_category['lines']" t-as="l">
                                <tr>
                                    <td><span t-field="l.name"/></td>
                                    <td class="text-right">
                                        <span t-field="l.product_uom_qty"/>
                                        <span t-field="l.product_uom" groups="product.group_uom"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-field="l.price_unit"/>
                                    </td>
                                    <td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">
                                        <span t-field="l.discount"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
                                    </td>
                                    <td class="text-right" groups="sale.group_show_price_subtotal">
                                        <span t-field="l.price_subtotal" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
                                    </td>
                                    <td class="text-right" groups="sale.group_show_price_total">
                                        <span t-field="l.price_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
                                    </td>
                                </tr>
                            </t>

                            <t t-if="(layout_category_size &gt; 1 or page_size &gt; 1) and layout_category['subtotal']" groups="sale.group_sale_layout">
                                <tr class="text-right">
                                    <td colspan="6">
                                        <strong>Subtotal: </strong>
                                        <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/>
                                        <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/>
                                    </td>
                                </tr>
                            </t>

                        </t>
                    </tbody>
                </table>

                <t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">
                    <p style="page-break-before:always;"> </p>
                </t>
            </t>

            <div class="row" name="total">
                <div class="col-xs-4 pull-right">
                    <table class="table table-condensed">
                        <tr class="border-black">
                            <td><strong>Total Without Taxes</strong></td>
                            <td class="text-right">
                                <span t-field="doc.amount_untaxed" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
                            </td>
                        </tr>
                        <t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group">
                            <tr>
                                <td><span t-esc="amount_by_group[0] or 'Taxes'"/></td>
                                <td class="text-right">
                                    <span t-esc="amount_by_group[1]" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
                                </td>
                            </tr>
                        </t>
                        <tr class="border-black">
                            <td><strong>Total</strong></td>
                            <td class="text-right">
                                <span t-field="doc.amount_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: doc.pricelist_id.currency_id}"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>


Come mi consigliate di procedere? Perché non riesco a richiamare con un if confizionale negativa quelle che nel report vengono chiamate layout_category

Avatar
Abbandona