From fad31d18d8ad10c7f574186dc62fda6334db58e9 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Tue, 21 Nov 2023 08:55:13 -0500 Subject: [PATCH] [14.0][ADD] repair_sale_order, partner_invoice_id same behavior of field partner_shipping_id --- repair_sale_order/models/repair_order.py | 7 ++++++- repair_sale_order/tests/test_repair_sale_order.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/repair_sale_order/models/repair_order.py b/repair_sale_order/models/repair_order.py index b0fa5c99..9dfd98a0 100644 --- a/repair_sale_order/models/repair_order.py +++ b/repair_sale_order/models/repair_order.py @@ -48,6 +48,7 @@ def _get_sale_order_data(self): self.address_id = addresses["delivery"] res = { "partner_id": self.partner_id.id, + "partner_invoice_id": self.partner_invoice_id.id, "partner_shipping_id": self.address_id.id, "origin": self.display_name, "note": self.quotation_notes, @@ -66,11 +67,15 @@ def action_create_sale_order(self): orders |= sale_order self.onchange_partner_id() partner_shipping_id = False + partner_invoice_id = False if sale_order.partner_shipping_id != sale_order.partner_id: partner_shipping_id = sale_order.partner_shipping_id - sale_order.onchange_partner_id() + if sale_order.partner_invoice_id != sale_order.partner_id: + partner_invoice_id = sale_order.partner_invoice_id if partner_shipping_id: sale_order.partner_shipping_id = partner_shipping_id + if partner_invoice_id: + sale_order.partner_invoice_id = partner_invoice_id for line in rec.operations: sale_order_line = order_line_model.create( line._get_sale_line_data(sale_order) diff --git a/repair_sale_order/tests/test_repair_sale_order.py b/repair_sale_order/tests/test_repair_sale_order.py index 50ea6520..c796771d 100644 --- a/repair_sale_order/tests/test_repair_sale_order.py +++ b/repair_sale_order/tests/test_repair_sale_order.py @@ -44,6 +44,7 @@ def setUp(self): "product_id": self.product1.id, "partner_id": self.partner.id, "location_id": self.env.ref("stock.stock_location_14").id, + "partner_invoice_id": self.partner.id, "repair_type_id": self.repair_type.id, } )