From c225a837dc920a754dfa1cfe08d20abaf5e322e1 Mon Sep 17 00:00:00 2001 From: "Merlin (megu)" Date: Tue, 4 Jan 2022 11:05:33 +0000 Subject: [PATCH] [FIX] l10n_de_stock,stock: delivery address in the top left 'Delivery Slip' report with the document layout 'DIN5008' needs to have the delivery address in the hole of the envelope Steps to reproduce: 1. Install Sales app as well as Drop Shipping and l10n_de module 2. Go to General Settings -> Document Layout and select external_layout_DIN5008 3. Specify a Dropship route for a product 4. Create and confirm an order for that product 5. Open the purchase order with the 'Purchase' tab 6. Confirm the corresponding purchase order 7. Open the 'Receipt' tab 8. Print the Delivery Slip 9. The document reference is above the address instead of under it Solution: Add the `l10n_de_addresses` computed field and set the addresses through `` and `` OPW-2709866 OPW-2715851 closes odoo/odoo#86039 X-original-commit: 2f7ad40d7480742a4e42875a4eec744db45a3914 Signed-off-by: William Henrotin (whe) Signed-off-by: Guillaume Merlin (megu) --- addons/l10n_din5008_stock/models/stock.py | 13 +++++++++ addons/stock/report/report_deliveryslip.xml | 32 ++++++++++++--------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/addons/l10n_din5008_stock/models/stock.py b/addons/l10n_din5008_stock/models/stock.py index 54fd028b623..5342ffed4c6 100644 --- a/addons/l10n_din5008_stock/models/stock.py +++ b/addons/l10n_din5008_stock/models/stock.py @@ -6,6 +6,7 @@ class StockPicking(models.Model): _inherit = 'stock.picking' l10n_din5008_template_data = fields.Binary(compute='_compute_l10n_din5008_template_data') + l10n_din5008_addresses = fields.Binary(compute='_compute_l10n_din5008_addresses') def _compute_l10n_din5008_template_data(self): for record in self: @@ -16,3 +17,15 @@ class StockPicking(models.Model): data.append((_("Shipping Date"), format_date(self.env, record.date_done))) else: data.append((_("Shipping Date"), format_date(self.env, record.scheduled_date))) + + def _compute_l10n_din5008_addresses(self): + for record in self: + record.l10n_din5008_addresses = data = [] + if record.partner_id: + if record.picking_type_id.code == 'incoming': + data.append((_('Vendor Address:'), record.partner_id)) + if record.picking_type_id.code == 'internal': + data.append((_('Warehouse Address:'), record.partner_id)) + if record.picking_type_id.code == 'outgoing' and record.move_ids_without_package and record.move_ids_without_package[0].partner_id \ + and record.move_ids_without_package[0].partner_id.id != record.partner_id.id: + data.append((_('Customer Address:'), record.partner_id)) diff --git a/addons/stock/report/report_deliveryslip.xml b/addons/stock/report/report_deliveryslip.xml index 016fc6e6453..3b19329da3d 100644 --- a/addons/stock/report/report_deliveryslip.xml +++ b/addons/stock/report/report_deliveryslip.xml @@ -6,21 +6,23 @@ -
-
-
-
- Delivery Address: -
-
-
- Warehouse Address: -
-
+ +
+
+ Delivery Address: +
-
+
+ Warehouse Address: +
+
+
+ + +
+
Vendor Address:
@@ -37,6 +39,8 @@
+ +