From ec1a7423d47ea2d159689bc9a396c7cce9050303 Mon Sep 17 00:00:00 2001 From: mafo-odoo Date: Wed, 30 Mar 2022 09:19:49 +0000 Subject: [PATCH] [FIX] sale,l10n_de_sale: Add the proforma in the title for din5008 sale report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step to reproduce: - install sale, accounting and l10n_de - activate proforma in sale settings - set the template to external_layout_din5008 in the settings (use developer mod) - create sales order or quotation - print it as a proforma Current behavior: - the proforma is missing from the title in the document Behaviour after PR: - the proforma is in the document title The l10n_de_sale module was missing the case scenario of a proforma sales report and the sale module only gives the information of a proforma report in the xml context. Then we add the case scenario and propagate the proforma info from the sale module also in the python context using the proforma variable. opw-2796603 closes odoo/odoo#88153 X-original-commit: 14e0f84abeba8453930522047df3610940d6aa9a Signed-off-by: William André (wan) --- addons/l10n_din5008_sale/i18n/l10n_din5008_sale.pot | 6 ++++++ addons/l10n_din5008_sale/models/sale.py | 4 +++- addons/sale/report/ir_actions_report_templates.xml | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/l10n_din5008_sale/i18n/l10n_din5008_sale.pot b/addons/l10n_din5008_sale/i18n/l10n_din5008_sale.pot index e84d0a5742e..13bc732a9b2 100644 --- a/addons/l10n_din5008_sale/i18n/l10n_din5008_sale.pot +++ b/addons/l10n_din5008_sale/i18n/l10n_din5008_sale.pot @@ -72,6 +72,12 @@ msgstr "" msgid "Order No." msgstr "" +#. module: l10n_din5008_sale +#: code:addons/l10n_din5008_sale/models/sale.py:0 +#, python-format +msgid "Pro Forma Invoice" +msgstr "" + #. module: l10n_din5008_sale #: code:addons/l10n_din5008_sale/models/sale.py:0 #, python-format diff --git a/addons/l10n_din5008_sale/models/sale.py b/addons/l10n_din5008_sale/models/sale.py index 0e90243d9f7..f25fd6db1b4 100644 --- a/addons/l10n_din5008_sale/models/sale.py +++ b/addons/l10n_din5008_sale/models/sale.py @@ -33,7 +33,9 @@ class SaleOrder(models.Model): def _compute_l10n_din5008_document_title(self): for record in self: - if record.state in ('draft', 'sent'): + if self._context.get('proforma'): + record.l10n_din5008_document_title = _('Pro Forma Invoice') + elif record.state in ('draft', 'sent'): record.l10n_din5008_document_title = _('Quotation') else: record.l10n_din5008_document_title = _('Sales Order') diff --git a/addons/sale/report/ir_actions_report_templates.xml b/addons/sale/report/ir_actions_report_templates.xml index aa0575055ab..258cfa33895 100644 --- a/addons/sale/report/ir_actions_report_templates.xml +++ b/addons/sale/report/ir_actions_report_templates.xml @@ -192,6 +192,7 @@