From 836edd622359408010730744377ac2f3b1f688f3 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 31 Oct 2023 10:07:17 +0100 Subject: [PATCH] [REF] joint_buying_product : rename request_id into transport_request_id. --- .../models/joint_buying_purchase_order.py | 12 ++++++------ .../tests/test_joint_buying_transport_request.py | 6 +++--- .../views/view_joint_buying_purchase_order.xml | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/joint_buying_product/models/joint_buying_purchase_order.py b/joint_buying_product/models/joint_buying_purchase_order.py index 13c1d7ba..4ff20a04 100644 --- a/joint_buying_product/models/joint_buying_purchase_order.py +++ b/joint_buying_product/models/joint_buying_purchase_order.py @@ -95,7 +95,7 @@ class JointBuyingPurchaseOrder(models.Model): selection=_PURCHASE_STATE, required=True, default="draft", track_visibility=True ) - request_id = fields.Many2one( + transport_request_id = fields.Many2one( comodel_name="joint.buying.transport.request", string="Transport Request", readonly=True, @@ -103,7 +103,7 @@ class JointBuyingPurchaseOrder(models.Model): request_arrival_date = fields.Datetime( string="Final Delivery Date", - related="request_id.arrival_date", + related="transport_request_id.arrival_date", ) pivot_company_id = fields.Many2one( @@ -315,14 +315,14 @@ def _hook_state_changed(self): x.state not in ["closed", "deposited"] or (x.total_weight or x.amount_untaxed) ) - and not x.request_id + and not x.transport_request_id and x.deposit_partner_id != x.customer_id ) if orders_request_to_create: vals_list = [{"order_id": x.id} for x in orders_request_to_create] requests = self.env["joint.buying.transport.request"].create(vals_list) for (order, request) in zip(orders_request_to_create, requests): - order.write({"request_id": request.id}) + order.write({"transport_request_id": request.id}) # Unlink transport request: # - if exist @@ -333,7 +333,7 @@ def _hook_state_changed(self): and not (x.total_weight or x.amount_untaxed) ) if orders_request_to_unlink: - orders_request_to_unlink.mapped("request_id").unlink() + orders_request_to_unlink.mapped("transport_request_id").unlink() @api.model_create_multi def create(self, vals_list): @@ -407,7 +407,7 @@ def button_see_request(self): xml_view = "joint_buying_product.view_joint_buying_transport_request_form" action = self.env.ref(xml_action).read()[0] action["views"] = [(self.env.ref(xml_view).id, "form")] - action["res_id"] = self.request_id.id + action["res_id"] = self.transport_request_id.id return action @api.multi diff --git a/joint_buying_product/tests/test_joint_buying_transport_request.py b/joint_buying_product/tests/test_joint_buying_transport_request.py index 03f0dee4..5070b285 100644 --- a/joint_buying_product/tests/test_joint_buying_transport_request.py +++ b/joint_buying_product/tests/test_joint_buying_transport_request.py @@ -25,8 +25,8 @@ def test_10_joint_buying_grouped_order_generate_transport_request(self): CDA_order = self._get_order_benoit_ronzon("CDA") # It should generate transport request for CDA and VEV - self.assertTrue(CDA_order.request_id) - self.assertTrue(VEV_order.request_id) + self.assertTrue(CDA_order.transport_request_id) + self.assertTrue(VEV_order.transport_request_id) # It should not create a transport request for LSE - self.assertFalse(LSE_order.request_id) + self.assertFalse(LSE_order.transport_request_id) diff --git a/joint_buying_product/views/view_joint_buying_purchase_order.xml b/joint_buying_product/views/view_joint_buying_purchase_order.xml index 0893a3a1..c68a936f 100644 --- a/joint_buying_product/views/view_joint_buying_purchase_order.xml +++ b/joint_buying_product/views/view_joint_buying_purchase_order.xml @@ -82,8 +82,8 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- -