From 868a9e7ed951825ba2e4ef4ab8048a9efd51a408 Mon Sep 17 00:00:00 2001 From: AlexPForgeFlow Date: Tue, 20 Aug 2024 10:46:04 +0200 Subject: [PATCH] [16.0][IMP] rma_account & rma_sale: fix delivery and invoice addresses --- rma_account/models/rma_order_line.py | 4 +++- rma_account/wizards/rma_add_account_move.py | 4 +++- rma_sale/models/rma_order_line.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rma_account/models/rma_order_line.py b/rma_account/models/rma_order_line.py index 74bca60d7..c96667e6e 100644 --- a/rma_account/models/rma_order_line.py +++ b/rma_account/models/rma_order_line.py @@ -211,7 +211,9 @@ def _prepare_rma_line_from_inv_line(self, line): line.date, round=False, ), - "delivery_address_id": line.move_id.partner_id.id, + "delivery_address_id": line.move_id.partner_shipping_id.id + if line.move_id.partner_shipping_id + else line.move_id.partner_id.id, "invoice_address_id": line.move_id.partner_id.id, "receipt_policy": operation.receipt_policy, "refund_policy": operation.refund_policy, diff --git a/rma_account/wizards/rma_add_account_move.py b/rma_account/wizards/rma_add_account_move.py index d4588f11c..0cf727ecd 100644 --- a/rma_account/wizards/rma_add_account_move.py +++ b/rma_account/wizards/rma_add_account_move.py @@ -89,7 +89,9 @@ def _prepare_rma_line_from_inv_line(self, line): line.date, round=False, ), - "delivery_address_id": line.move_id.partner_id.id, + "delivery_address_id": line.move_id.partner_shipping_id.id + if line.move_id.partner_shipping_id + else line.move_id.partner_id.id, "invoice_address_id": line.move_id.partner_id.id, "rma_id": self.rma_id.id, "receipt_policy": operation.receipt_policy, diff --git a/rma_sale/models/rma_order_line.py b/rma_sale/models/rma_order_line.py index 4f722a08b..86c9aff46 100644 --- a/rma_sale/models/rma_order_line.py +++ b/rma_sale/models/rma_order_line.py @@ -139,8 +139,8 @@ def _prepare_rma_line_from_sale_order_line(self, line): "uom_id": line.product_uom.id, "operation_id": operation.id, "product_qty": line.product_uom_qty, - "delivery_address_id": line.order_id.partner_id.id, - "invoice_address_id": line.order_id.partner_id.id, + "delivery_address_id": line.order_id.partner_shipping_id.id, + "invoice_address_id": line.order_id.partner_invoice_id.id, "price_unit": line.currency_id._convert( line.price_unit, line.currency_id,