From ad2ccbbb59b7bf633e566214fdf2b811451559ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= <tde@odoo.com> Date: Fri, 31 Mar 2017 14:07:26 +0200 Subject: [PATCH] [IMP] account related addons: improve report naming and use print_report_name Purpose of this commit is to clean and uniformize report naming through various addons. It has been chosen to name them using a formatting like <report_name> - <object_name or suffix> . Improve report naming in sale, point of sale, l10n_ch, purchase, purchase requisition, report intrastat, website_quote --- addons/account/views/account_report.xml | 45 +++++++++---------- addons/l10n_ch/report/isr_report.xml | 16 +++---- .../views/point_of_sale_report.xml | 2 +- addons/purchase/report/purchase_reports.xml | 14 +++--- .../report/purchase_requisition_report.xml | 22 ++++----- .../report/report_intrastat_report.xml | 19 ++++---- addons/sale/report/sale_report.xml | 10 ++--- .../report/sale_order_reports.xml | 6 +-- 8 files changed, 57 insertions(+), 77 deletions(-) diff --git a/addons/account/views/account_report.xml b/addons/account/views/account_report.xml index ddf5cb21cb02..36f7eea7ee85 100644 --- a/addons/account/views/account_report.xml +++ b/addons/account/views/account_report.xml @@ -11,19 +11,17 @@ file="account.report_invoice" attachment_use="True" attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')" + print_report_name="( + object.type == 'out_invoice' and object.state == 'draft' and 'Draft Invoice' or + object.type == 'out_invoice' and object.state in ('open','paid') and 'Invoice - %s' % (object.number) or + object.type == 'out_refund' and object.state == 'draft' and 'Credit Note' or + object.type == 'out_refund' and 'Credit Note - %s' % (object.number) or + object.type == 'in_invoice' and object.state == 'draft' and 'Vendor Bill' or + object.type == 'in_invoice' and object.state in ('open','paid') and 'Vendor Bill - %s' % (object.number) or + object.type == 'in_refund' and object.state == 'draft' and 'Vendor Credit Note' or + object.type == 'in_refund' and 'Vendor Credit Note - %s' % (object.number))" /> - <record id="account_invoices" model="ir.actions.report"> - <field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Draft Invoice' or - object.type == 'out_invoice' and object.state in ('open','paid') and 'Invoice'+'-'+(object.number) or - object.type == 'out_refund' and object.state == 'draft' and 'Credit Note' or - object.type == 'out_refund' and 'Credit Note'+'-'+(object.number) or - object.type == 'in_invoice' and object.state == 'draft' and 'Vendor Bill' or - object.type == 'in_invoice' and object.state in ('open','paid') and 'Vendor Bill'+'-'+(object.number) or - object.type == 'in_refund' and object.state == 'draft' and 'Vendor Credit Note' or - object.type == 'in_refund' and 'Vendor Credit Note'+'-'+(object.number))</field> - </record> - <report id="account_invoice_action_report_duplicate" model="account.invoice" @@ -32,17 +30,16 @@ name="account.account_invoice_report_duplicate_main" file="account.report_invoice_duplicate" attachment_use="False" + print_report_name="( + object.type == 'out_invoice' and object.state == 'draft' and 'Duplicate Invoice' or + object.type == 'out_invoice' and object.state in ('open','paid') and 'Duplicate Invoice - %s' % (object.number) or + object.type == 'out_refund' and object.state == 'draft' and 'Duplicate Credit Note' or + object.type == 'out_refund' and 'Duplicate Credit Note - %s' % (object.number) or + object.type == 'in_invoice' and object.state == 'draft' and 'Duplicate Vendor Bill' or + object.type == 'in_invoice' and object.state in ('open','paid') and 'Duplicate Vendor Bill - %s' % (object.number) or + object.type == 'in_refund' and object.state == 'draft' and 'Duplicate Vendor Credit Note' or + object.type == 'in_refund' and 'Duplicate Vendor Credit Note - %s' % (object.number))" /> - <record id="account_invoice_action_report_duplicate" model="ir.actions.report"> - <field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Duplicate Invoice' or - object.type == 'out_invoice' and object.state in ('open','paid') and 'Duplicate Invoice'+'-'+(object.number) or - object.type == 'out_refund' and object.state == 'draft' and 'Duplicate Credit Note' or - object.type == 'out_refund' and 'Duplicate Credit Note'+'-'+(object.number) or - object.type == 'in_invoice' and object.state == 'draft' and 'Duplicate Vendor Bill' or - object.type == 'in_invoice' and object.state in ('open','paid') and 'Duplicate Vendor Bill'+'-'+(object.number) or - object.type == 'in_refund' and object.state == 'draft' and 'Duplicate Vendor Credit Note' or - object.type == 'in_refund' and 'Duplicate Vendor Credit Note'+'-'+(object.number))</field> - </record> <report id="action_report_print_overdue" @@ -51,10 +48,8 @@ string="Due Payments" name="account.report_overdue" file="account.report_overdue" - /> - <record id="action_report_print_overdue" model="ir.actions.report"> - <field name="print_report_name">'Due Payments'+'-'+(object.name)</field> - </record> + print_report_name="'Due Payments - %s' % (object.name)" + /> <report id="action_report_general_ledger" diff --git a/addons/l10n_ch/report/isr_report.xml b/addons/l10n_ch/report/isr_report.xml index afd0d6015bc7..a64167b565e9 100644 --- a/addons/l10n_ch/report/isr_report.xml +++ b/addons/l10n_ch/report/isr_report.xml @@ -25,17 +25,11 @@ attachment_use="True" attachment="'ISR-' + object.number + '.pdf'" menu="False" - /> - - <record id="l10n_ch_isr_report" model ="ir.actions.report"> - <field name="print_report_name"> - 'ISR-' + object.number - <!--No additional condition on invoice state or type as this - report is only available to be printed for out invoices after - 'draft' state, if the fields required by the ISR have been set.--> - </field> - <field name="paperformat_id" ref="paperformat_euro_no_margin"/> - </record> + print_report_name="'ISR-%s' % object.number" + paperformat="paperformat_euro_no_margin"/> + <!--No additional condition in report name on invoice state or type as this + report is only available to be printed for out invoices after + 'draft' state, if the fields required by the ISR have been set.--> <template id="assets_common" name="l10n_ch_isr_report" inherit_id="web.assets_common"> <xpath expr="." position="inside"> diff --git a/addons/point_of_sale/views/point_of_sale_report.xml b/addons/point_of_sale/views/point_of_sale_report.xml index d010e7fcfe47..ec7831b814a9 100644 --- a/addons/point_of_sale/views/point_of_sale_report.xml +++ b/addons/point_of_sale/views/point_of_sale_report.xml @@ -15,7 +15,7 @@ <field name="model">pos.order</field> <field name="report_type">qweb-pdf</field> <field name="report_name">point_of_sale.report_invoice</field> - <field name="print_report_name">'Invoice'+'-'+(object.name)</field> + <field name="print_report_name">'Invoice - %s' % (object.name)</field> </record> <record id="sale_details_report" model="ir.actions.report"> diff --git a/addons/purchase/report/purchase_reports.xml b/addons/purchase/report/purchase_reports.xml index 33524f2342c9..913a41021ad3 100644 --- a/addons/purchase/report/purchase_reports.xml +++ b/addons/purchase/report/purchase_reports.xml @@ -1,16 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> + <data> <report string="Purchase Order" id="action_report_purchase_order" model="purchase.order" report_type="qweb-pdf" name="purchase.report_purchaseorder" - file="purchase.report_purchaseorder" + file="purchase.report_purchaseorder" + print_report_name=" + (object.state in ('draft', 'sent') and 'Request for Quotation - %s' % (object.name) or + 'Purchase Order - %s' % (object.name))" /> - <record id="action_report_purchase_order" model="ir.actions.report"> - <field name="print_report_name">(object.state in ('draft', 'sent') and 'Request for Quotation'+'-'+(object.name) or 'Purchase Order'+'-'+(object.name))</field> - </record> <report string="Request for Quotation" @@ -19,8 +20,7 @@ report_type="qweb-pdf" name="purchase.report_purchasequotation" file="purchase.report_purchasequotation" + print_report_name="'Request for Quotation - %s' % (object.name)" /> - <record id="report_purchase_quotation" model="ir.actions.report"> - <field name="print_report_name">'Request for Quotation'+'-'+(object.name)</field> - </record> + </data> </odoo> diff --git a/addons/purchase_requisition/report/purchase_requisition_report.xml b/addons/purchase_requisition/report/purchase_requisition_report.xml index 0870c38afb0a..91b537ad3569 100644 --- a/addons/purchase_requisition/report/purchase_requisition_report.xml +++ b/addons/purchase_requisition/report/purchase_requisition_report.xml @@ -1,16 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> - <data> - <report - string="Call for Tenders" - id="action_report_purchase_requisitions" - model="purchase.requisition" - report_type="qweb-pdf" - name="purchase_requisition.report_purchaserequisitions" - file="purchase_requisition.report.report_purchaserequisitions" - /> - <record id="action_report_purchase_requisitions" model="ir.actions.report"> - <field name="print_report_name">'Tender'+'-'+(object.name)</field> - </record> - </data> + <report + string="Call for Tenders" + id="action_report_purchase_requisitions" + model="purchase.requisition" + report_type="qweb-pdf" + name="purchase_requisition.report_purchaserequisitions" + file="purchase_requisition.report.report_purchaserequisitions" + print_report_name="'Tender - %s' % (object.name)" + /> </odoo> diff --git a/addons/report_intrastat/report/report_intrastat_report.xml b/addons/report_intrastat/report/report_intrastat_report.xml index 126c059b1092..01d37444b07c 100644 --- a/addons/report_intrastat/report/report_intrastat_report.xml +++ b/addons/report_intrastat/report/report_intrastat_report.xml @@ -7,15 +7,14 @@ report_type="qweb-pdf" name="report_intrastat.report_intrastatinvoice" file="report_intrastat.report_intrastatinvoice" + print_report_name=" + (object.type == 'out_invoice' and object.state == 'draft' and 'Intrastat Invoice' or + object.type == 'out_invoice' and object.state in ('open','paid') and 'Intrastat Invoice - %s' % (object.number) or + object.type == 'out_refund' and object.state == 'draft' and 'Intrastat Credit Note' or + object.type == 'out_refund' and 'Intrastat Credit Note - %s' % (object.number) or + object.type == 'in_invoice' and object.state == 'draft' and 'Intrastat Vendor Bill' or + object.type == 'in_invoice' and object.state in ('open','paid') and 'Intrastat Vendor Bill - %s' % (object.number) or + object.type == 'in_refund' and object.state == 'draft' and 'Intrastat Vendor Credit Note' or + object.type == 'in_refund' and 'Intrastat Vendor Credit Note - %s' % (object.number))" /> - <record id="account_intrastatinvoices" model="ir.actions.report"> - <field name="print_report_name">(object.type == 'out_invoice' and object.state == 'draft' and 'Intrastat Invoice' or - object.type == 'out_invoice' and object.state in ('open','paid') and 'Intrastat Invoice'+'-'+(object.number) or - object.type == 'out_refund' and object.state == 'draft' and 'Intrastat Credit Note' or - object.type == 'out_refund' and 'Intrastat Credit Note'+'-'+(object.number) or - object.type == 'in_invoice' and object.state == 'draft' and 'Intrastat Vendor Bill' or - object.type == 'in_invoice' and object.state in ('open','paid') and 'Intrastat Vendor Bill'+'-'+(object.number) or - object.type == 'in_refund' and object.state == 'draft' and 'Intrastat Vendor Credit Note' or - object.type == 'in_refund' and 'Intrastat Vendor Credit Note'+'-'+(object.number))</field> - </record> </odoo> diff --git a/addons/sale/report/sale_report.xml b/addons/sale/report/sale_report.xml index 866ec989a051..760121871104 100644 --- a/addons/sale/report/sale_report.xml +++ b/addons/sale/report/sale_report.xml @@ -7,11 +7,9 @@ model="sale.order" report_type="qweb-pdf" file="sale.report_saleorder" - name="sale.report_saleorder" + name="sale.report_saleorder" + print_report_name="(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)" /> - <record id="action_report_saleorder" model="ir.actions.report"> - <field name="print_report_name">(object.state in ('draft', 'sent') and 'Quotation'+'-'+(object.name) or 'Order'+'-'+(object.name))</field> - </record> <report string="Pro-Forma" @@ -20,9 +18,7 @@ report_type="qweb-pdf" name="sale.report_saleproforma" file="sale.report_saleorder" + print_report_name="'Pro-Forma - %s' % (object.name)" /> - <record id="report_proforma_quotation" model="ir.actions.report"> - <field name="print_report_name">'Pro-Forma'+'-'+(object.name)</field> - </record> </data> </odoo> diff --git a/addons/website_quote/report/sale_order_reports.xml b/addons/website_quote/report/sale_order_reports.xml index c3c8078545f4..ce6877469fda 100644 --- a/addons/website_quote/report/sale_order_reports.xml +++ b/addons/website_quote/report/sale_order_reports.xml @@ -8,8 +8,8 @@ file="website_quote.report_quotation" name="website_quote.report_quote" menu="False" + print_report_name=" + (object.state in ('draft', 'sent') and 'Quotation - %s' % object.name or + 'Order - %s' % (object.name))" /> - <record id="report_web_quote" model="ir.actions.report"> - <field name="print_report_name">(object.state in ('draft', 'sent') and 'Quotation'+'-'+(object.name) or 'Order'+'-'+(object.name))</field> - </record> </odoo> -- GitLab