From 11514354413aa68523cf11e1422f88c094bb11ae Mon Sep 17 00:00:00 2001 From: Bert Van Groenendael Date: Tue, 22 Oct 2024 10:39:15 +0200 Subject: [PATCH] [18.0][MIG] sale_blanket_order: Migration to 18.0 --- sale_blanket_order/data/ir_cron.xml | 2 -- sale_blanket_order/models/blanket_orders.py | 14 ++-------- .../tests/test_blanket_orders.py | 3 -- .../views/sale_blanket_order_line_views.xml | 10 +++---- .../views/sale_blanket_order_views.xml | 28 +++++-------------- sale_blanket_order/views/sale_order_views.xml | 4 +-- .../wizard/create_sale_orders.py | 3 +- .../wizard/create_sale_orders.xml | 4 +-- 8 files changed, 19 insertions(+), 49 deletions(-) diff --git a/sale_blanket_order/data/ir_cron.xml b/sale_blanket_order/data/ir_cron.xml index 338d4a6e49a..11ce5097e17 100644 --- a/sale_blanket_order/data/ir_cron.xml +++ b/sale_blanket_order/data/ir_cron.xml @@ -10,8 +10,6 @@ name="nextcall" eval="(DateTime.now() + relativedelta(hour=00, minute=1, second=0)).strftime('%Y-%m-%d %H:%M:%S')" /> - -1 - code model.expire_orders() diff --git a/sale_blanket_order/models/blanket_orders.py b/sale_blanket_order/models/blanket_orders.py index 2b1db0f3c1e..4dbfcdff646 100644 --- a/sale_blanket_order/models/blanket_orders.py +++ b/sale_blanket_order/models/blanket_orders.py @@ -62,13 +62,6 @@ def _compute_amount_all(self): required=True, ) currency_id = fields.Many2one("res.currency", related="pricelist_id.currency_id") - analytic_account_id = fields.Many2one( - comodel_name="account.analytic.account", - string="Analytic Account", - copy=False, - check_company=True, - domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", - ) payment_term_id = fields.Many2one( "account.payment.term", string="Payment Terms", @@ -236,8 +229,8 @@ def onchange_partner_id(self): if self.partner_id.user_id: values["user_id"] = self.partner_id.user_id.id - if self.partner_id.team_id: - values["team_id"] = self.partner_id.team_id.id + if self.partner_id.user_id.sale_team_id: + values["team_id"] = self.partner_id.user_id.sale_team_id.id self.update(values) def unlink(self): @@ -571,9 +564,6 @@ def _get_display_price(self): currency=self.currency_id, ) - if self.order_id.pricelist_id.discount_policy == "with_discount": - return pricelist_price - if not self.pricelist_item_id: # No pricelist rule found => no discount from pricelist return pricelist_price diff --git a/sale_blanket_order/tests/test_blanket_orders.py b/sale_blanket_order/tests/test_blanket_orders.py index 37a56cfed3c..42220056469 100644 --- a/sale_blanket_order/tests/test_blanket_orders.py +++ b/sale_blanket_order/tests/test_blanket_orders.py @@ -95,9 +95,6 @@ def test_01_create_blanket_order(self): } ) blanket_order.sudo().onchange_partner_id() - blanket_order.pricelist_id.discount_policy = "without_discount" - blanket_order.line_ids[0].sudo().onchange_product() - blanket_order.pricelist_id.discount_policy = "with_discount" blanket_order.line_ids[0].sudo().onchange_product() blanket_order.line_ids[0].sudo()._get_display_price() diff --git a/sale_blanket_order/views/sale_blanket_order_line_views.xml b/sale_blanket_order/views/sale_blanket_order_line_views.xml index 661e451c643..c12770de400 100644 --- a/sale_blanket_order/views/sale_blanket_order_line_views.xml +++ b/sale_blanket_order/views/sale_blanket_order_line_views.xml @@ -3,10 +3,10 @@ - sale.blanket.order.line.tree + sale.blanket.order.line.list sale.blanket.order.line - + @@ -27,7 +27,7 @@ - + @@ -127,7 +127,7 @@ @@ -164,7 +164,7 @@ Blanket Order Lines ir.actions.act_window sale.blanket.order.line - tree,form + list,form diff --git a/sale_blanket_order/views/sale_blanket_order_views.xml b/sale_blanket_order/views/sale_blanket_order_views.xml index d5a62b1db6d..cfd26476430 100644 --- a/sale_blanket_order/views/sale_blanket_order_views.xml +++ b/sale_blanket_order/views/sale_blanket_order_views.xml @@ -3,10 +3,10 @@ - sale.blanket.order.tree + sale.blanket.order.list sale.blanket.order - @@ -21,7 +21,7 @@ optional="show" readonly="1" /> - + @@ -121,7 +121,7 @@ readonly="state in ['open', 'done', 'expired']" widget="section_and_note_one2many" > - + - + - - - - - -
- - - -
+
@@ -342,7 +328,7 @@ Blanket Orders ir.actions.act_window sale.blanket.order - tree,form + list,form [] {} diff --git a/sale_blanket_order/views/sale_order_views.xml b/sale_blanket_order/views/sale_order_views.xml index 3e8cc4dc8dc..405111c9438 100644 --- a/sale_blanket_order/views/sale_order_views.xml +++ b/sale_blanket_order/views/sale_order_views.xml @@ -9,7 +9,7 @@ sale.order - + blanket_order_id==False diff --git a/sale_blanket_order/wizard/create_sale_orders.py b/sale_blanket_order/wizard/create_sale_orders.py index 08cbfdb612e..6f9a19228a1 100644 --- a/sale_blanket_order/wizard/create_sale_orders.py +++ b/sale_blanket_order/wizard/create_sale_orders.py @@ -129,7 +129,6 @@ def _prepare_so_vals( "pricelist_id": pricelist_id, "payment_term_id": payment_term_id, "order_line": order_lines_by_customer[customer], - "analytic_account_id": self.blanket_order_id.analytic_account_id.id, } def create_sale_order(self): @@ -191,7 +190,7 @@ def create_sale_order(self): "domain": [("id", "in", res)], "name": _("Sales Orders"), "view_type": "form", - "view_mode": "tree,form", + "view_mode": "list,form", "res_model": "sale.order", "context": {"from_sale_order": True}, "type": "ir.actions.act_window", diff --git a/sale_blanket_order/wizard/create_sale_orders.xml b/sale_blanket_order/wizard/create_sale_orders.xml index 9cb02710c7b..b34143d749b 100644 --- a/sale_blanket_order/wizard/create_sale_orders.xml +++ b/sale_blanket_order/wizard/create_sale_orders.xml @@ -7,7 +7,7 @@
- + - +