From 1cdd1db411614e69069161783ae3c687a161b071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Fri, 30 Sep 2022 14:53:49 +0200 Subject: [PATCH] [ADD] sale order preparation report --- __manifest__.py | 1 + report/report_saleorder_preparation.xml | 105 ++++++++++++++++++++++++ static/src/scss/layout_generic.scss | 6 ++ views/assets.xml | 13 +++ views/sale_order.xml | 15 ++++ 5 files changed, 140 insertions(+) create mode 100644 report/report_saleorder_preparation.xml create mode 100644 static/src/scss/layout_generic.scss create mode 100644 views/assets.xml diff --git a/__manifest__.py b/__manifest__.py index d510d86..61fff77 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -24,6 +24,7 @@ "report/report_invoice.xml", "report/report_pricelist.xml", "report/report_saleorder.xml", + "report/report_saleorder_preparation.xml", "report/report_stockpicking_operations.xml", # views menu # wizard diff --git a/report/report_saleorder_preparation.xml b/report/report_saleorder_preparation.xml new file mode 100644 index 0000000..cd14341 --- /dev/null +++ b/report/report_saleorder_preparation.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <data> + <template id="report_sale_order_preparation"> + <t t-call="web.html_container"> + <t t-foreach="docs" t-as="o"> + <t t-call="web.external_layout"> + <div class="page"> + <div class="row"> + <div class="col-6" name="div_outgoing_address"> + <div> + <span><strong + >Adresse du client :</strong></span> + <div + t-field="o.partner_shipping_id" + t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' + /> + </div> + </div> + </div> + <br /> + <h1 t-field="o.name" class="mt0 float-left" /> + <div class="row mt48 mb32"> + <div class="col-auto" name="div_state"> + <strong>Statut :</strong> + <p t-field="o.state" /> + </div> + <div class="col-auto" name="div_commitment_date"> + <strong>Date de livraison prévue :</strong> + <p t-field="o.commitment_date" /> + </div> + <div class="col-auto" name="div_transporter"> + <strong>Transporteur :</strong> + <p t-field="o.res_transporter_id" /> + </div> + <div class="col-auto" name="div_packaging"> + <strong>Emballage :</strong> + <p t-field="o.packaging_id" /> + </div> + <div class="col-auto" name="div_billing"> + <strong>Type de facturation :</strong> + <p t-field="o.billing_type_id" /> + </div> + </div> + <div class="row mt48 mb32"> + <div + t-if="o.partner_shipping_id.delivery_note" + class="col-auto" + name="div_delivery_note" + > + <strong>Note :</strong> + <p t-field="o.partner_shipping_id.delivery_note" /> + </div> + </div> + <table + class="table table-sm table-prepa" + t-if="o.order_line" + > + <thead> + <tr> + <th name="th_product"> + <strong>Article</strong> + </th> + <th name="th_qty"> + <strong>Quantité</strong> + </th> + <th name="th_serial_number" class="text-center"> + <strong>Numéro de Lot</strong> + </th> + <th name="th_expiry" class="text-center"> + <strong>DLC</strong> + </th> + </tr> + </thead> + <tbody> + <t t-foreach="o.order_line" t-as="line"> + <tr> + <td> + <span + t-field="line.product_id.display_name" + /><br /> + <span + t-field="line.product_id.description" + /> + </td> + <td> + <span t-field="line.product_uom_qty" /> + <span + t-field="line.product_uom" + groups="uom.group_uom" + /> + + </td> + </tr> + </t> + </tbody> + </table> + <p t-field="o.note" /> + </div> + </t> + </t> + </t> + </template> + </data> +</odoo> diff --git a/static/src/scss/layout_generic.scss b/static/src/scss/layout_generic.scss new file mode 100644 index 0000000..2b4c15a --- /dev/null +++ b/static/src/scss/layout_generic.scss @@ -0,0 +1,6 @@ +/*** + Preparations +***/ +.table-prepa td { + border: thin solid #000; +} diff --git a/views/assets.xml b/views/assets.xml new file mode 100644 index 0000000..145c7fb --- /dev/null +++ b/views/assets.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <!-- Assets for reports --> + <template id="report_assets_common" inherit_id="web.report_assets_common"> + <xpath expr="." position="inside"> + <link + rel="stylesheet" + type="text/scss" + href="/fumoc_sale/static/src/scss/layout_generic.scss" + /> + </xpath> + </template> +</odoo> diff --git a/views/sale_order.xml b/views/sale_order.xml index b92a931..cd47c1b 100644 --- a/views/sale_order.xml +++ b/views/sale_order.xml @@ -46,5 +46,20 @@ </field> </record> + <record id="action_report_sale_preparation" model="ir.actions.report"> + <field name="name">Préparation Commande</field> + <field name="model">sale.order</field> + <field name="report_type">qweb-pdf</field> + <field name="report_name">fumoc_sale.report_sale_order_preparation</field> + <field + name="report_file" + >fumoc_sale.report_sale_order_preparation_operations</field> + <field + name="print_report_name" + >'Préparation de Commande - %s - %s' % (object.name, object.partner_id.name or '')</field> + <field name="binding_model_id" ref="model_sale_order" /> + <field name="binding_type">report</field> + </record> + </data> </odoo> -- GitLab