From 81b9968330797e57382afe127b4dc08bcea5f987 Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Thu, 18 Nov 2021 10:56:42 +0100
Subject: [PATCH] =?UTF-8?q?Change=20report=20compo=20+=20add=20cat=20in=20?=
 =?UTF-8?q?pr=C3=A9paration=20report?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 data/paperformat_data.xml              |  2 +-
 views/report_composition_templates.xml |  4 +--
 views/report_delivery_ap_template.xml  | 48 +++++++++++++++++---------
 views/report_templates.xml             |  2 +-
 4 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/data/paperformat_data.xml b/data/paperformat_data.xml
index f6250bb..3f109b4 100644
--- a/data/paperformat_data.xml
+++ b/data/paperformat_data.xml
@@ -8,7 +8,7 @@
             <field name="page_height">0</field>
             <field name="page_width">0</field>
             <field name="orientation">Landscape</field>
-            <field name="margin_top">40</field>
+            <field name="margin_top">30</field>
             <field name="margin_bottom">32</field>
             <field name="margin_left">7</field>
             <field name="margin_right">7</field>
diff --git a/views/report_composition_templates.xml b/views/report_composition_templates.xml
index 7c7b479..4625154 100644
--- a/views/report_composition_templates.xml
+++ b/views/report_composition_templates.xml
@@ -8,7 +8,7 @@
                 <h1 class="mt0 text-center">Compositions</h1>
                 <div class="page">
                     <div class="row">
-                        <div class="col-6" name="div_outgoing_address">
+                        <div class="col-8" name="div_outgoing_address">
                             <h2>
                                 <t
                                     t-if="not (env.context.get('proforma', False) or is_pro_forma)"
@@ -37,7 +37,7 @@
                                     /></p>
                             </div>
                         </div>
-                        <div class="col-6" name="div_outgoing_address">
+                        <div class="col-4" name="div_outgoing_address">
                             <div>
                                 <div
                                     t-field="doc.partner_id"
diff --git a/views/report_delivery_ap_template.xml b/views/report_delivery_ap_template.xml
index 75544b1..4c9c2f0 100644
--- a/views/report_delivery_ap_template.xml
+++ b/views/report_delivery_ap_template.xml
@@ -41,38 +41,54 @@
                             </tr>
                         </thead>
                         <tbody>
-                            <t t-foreach="o.move_ids_without_package" t-as="move">
-                                <t
-                                    t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)"
-                                    t-as="ml"
-                                >
-                                    <tr>
+                            <t t-set="product_category" t-value="[]"/>
+
+                            <t t-foreach="o.move_ids_without_package" t-as="l">
+
+                                <t t-set="product_category" t-value="product_category+[l.product_id.categ_id]"/>
+
+                            </t>
+
+                            <t t-foreach="set(product_category)" t-as="category">
+
+                                <tr>
+                                        <td />
+                                        <td>
+                                            <div><strong t-esc="category.name"/></div>
+                                        </td>
+                                        <td>
+                                        </td>
+                                    </tr>
+
+                                <t t-foreach="o.move_ids_without_package" t-as="l">
+
+                                    <t t-if="category.id==l.product_id.categ_id.id">
+
+                                        <tr>
                                         <td />
                                         <td>
                                             <span
-                                                t-field="ml.product_id.display_name"
+                                                t-field="l.product_id.display_name"
                                             /><br />
                                             <span
-                                                t-field="ml.product_id.description_picking"
+                                                t-field="l.product_id.description_picking"
                                             />
                                         </td>
                                         <td>
                                             <span
-                                                t-if="o.state != 'done'"
-                                                t-field="ml.product_uom_qty"
-                                            />
-                                            <span
-                                                t-if="o.state == 'done'"
-                                                t-field="ml.qty_done"
+                                                t-if="l.state != 'done'"
+                                                t-field="l.product_uom_qty"
                                             />
                                             <span
-                                                t-field="ml.product_uom_id"
-                                                groups="uom.group_uom"
+                                                t-if="l.state == 'done'"
+                                                t-field="l.qty_done"
                                             />
                                         </td>
                                     </tr>
+                                    </t>
                                 </t>
                             </t>
+
                         </tbody>
                     </table>
                 </div>
diff --git a/views/report_templates.xml b/views/report_templates.xml
index b576f63..482e2c3 100644
--- a/views/report_templates.xml
+++ b/views/report_templates.xml
@@ -108,7 +108,7 @@
                     <img
                         t-if="company.logo"
                         t-att-src="image_data_uri(company.logo)"
-                        style="max-height: 45px;"
+                        style="max-height: 80px;"
                         alt="Logo"
                     />
                 </div>
-- 
GitLab