From 724f37dd4bf5e164f9934ae2e85b7ef068cc1e1d Mon Sep 17 00:00:00 2001 From: stopkovae Date: Mon, 8 Dec 2025 17:19:55 +0000 Subject: [PATCH] chore: todos merge 18 --- stock_ux/models/stock_move.py | 5 +++++ stock_ux/models/stock_move_line.py | 3 +++ stock_ux/models/stock_picking.py | 7 +++++++ stock_ux/models/stock_rule.py | 1 + stock_ux/models/stock_warehouse_orderpoint.py | 2 ++ 5 files changed, 18 insertions(+) diff --git a/stock_ux/models/stock_move.py b/stock_ux/models/stock_move.py index c405bc280..7f4679bf0 100644 --- a/stock_ux/models/stock_move.py +++ b/stock_ux/models/stock_move.py @@ -53,6 +53,7 @@ def _compute_origin_description(self): @api.constrains("quantity") def _check_quantity(self): + # TODO: Odoo BTL - lock for AR precision = self.env["decimal.precision"].precision_get("Product Unit of Measure") if any(self.filtered(lambda x: x.scrapped)): return @@ -97,6 +98,7 @@ def action_view_linked_record(self): def default_get(self, fields_list): # We override the default_get to make stock moves created when the picking # was confirmed , this way restrict to add more quantity that initial demand + # TODO: Odoo BTL - lock for AR defaults = super().default_get(fields_list) if self.env.context.get("default_picking_id"): picking_id = self.env["stock.picking"].browse(self.env.context["default_picking_id"]) @@ -108,6 +110,7 @@ def default_get(self, fields_list): @api.constrains("state") def check_cancel(self): + # TODO: Odoo BTL - lock for AR if self._context.get("cancel_from_order") or self.env.is_superuser(): return if self.filtered( @@ -143,6 +146,7 @@ def create(self, vals_list): @api.depends("state", "picking_id") def _compute_is_initial_demand_editable(self): + # TODO: Odoo BTL - lock for AR super(StockMove, self)._compute_is_initial_demand_editable() for move in self: if move.picking_id.picking_type_id.block_additional_quantity and move.picking_id.state != "draft": @@ -152,6 +156,7 @@ def _trigger_assign(self): """To avoid to check_quantity_available when an assing in move is trigger we send a context that checks if the assign comes from this method """ + # TODO: Odoo BTL - lock for AR if not self.env.context.get("trigger_assign"): return super().with_context(trigger_assign=True)._trigger_assign() return super()._trigger_assign() diff --git a/stock_ux/models/stock_move_line.py b/stock_ux/models/stock_move_line.py index bf74a5c19..981486d69 100644 --- a/stock_ux/models/stock_move_line.py +++ b/stock_ux/models/stock_move_line.py @@ -36,6 +36,7 @@ class StockMoveLine(models.Model): @api.depends_context("location") def _compute_product_uom_qty_location(self): + # TODO: Odoo BTL - lock for AR location = self._context.get("location") if not location: self.update({"product_uom_qty_location": 0.0}) @@ -56,6 +57,7 @@ def _compute_product_uom_qty_location(self): @api.constrains("quantity") def _check_manual_lines(self): + # TODO: Odoo BTL - lock for AR if self._context.get("put_in_pack", False): return invalid_lines = self.filtered( @@ -109,6 +111,7 @@ def create(self, vals_list): """This is to solve a bug when create the sml (the value is not completed after creation) and should be reported to odoo to solve.""" recs = super().create(vals_list) + # TODO: Odoo BTL - lock for AR for rec in recs: if rec.picking_id and not rec.description_picking: product = rec.product_id.with_context(lang=rec.picking_id.partner_id.lang or rec.env.user.lang) diff --git a/stock_ux/models/stock_picking.py b/stock_ux/models/stock_picking.py index 0694694c0..cbeeda024 100644 --- a/stock_ux/models/stock_picking.py +++ b/stock_ux/models/stock_picking.py @@ -28,6 +28,7 @@ def unlink(self): To avoid errors we block deletion of pickings in other state than draft or cancel """ + # TODO: Odoo BTL - lock for AR not_del_pickings = self.filtered( lambda x: x.picking_type_id.block_picking_deletion or x.state not in ("draft", "cancel") ) @@ -44,6 +45,7 @@ def unlink(self): return super().unlink() def copy(self, default=None): + # TODO: Odoo BTL - lock for AR for picking in self: if not default and picking.picking_type_id.block_additional_quantity: raise UserError( @@ -56,17 +58,20 @@ def copy(self, default=None): @api.onchange("location_id") def change_location(self): + # TODO: Odoo BTL - lock for AR # we only change moves locations if picking in draft if self.state == "draft": self.move_ids.update({"location_id": self.location_id.id}) @api.onchange("location_dest_id") def change_location_dest(self): + # TODO: Odoo BTL - lock for AR # we only change moves locations if picking in draft if self.state == "draft": self.move_ids.update({"location_dest_id": self.location_dest_id.id}) def _send_confirmation_email(self): + # TODO: Odoo BTL - lock for AR for rec in self: if rec.picking_type_id.mail_template_id: try: @@ -90,6 +95,7 @@ def _send_confirmation_email(self): super(StockPicking, self)._send_confirmation_email() def _action_done(self): + # TODO: Odoo BTL - lock for AR for rec in self.with_context( mail_notify_force_send=False, email_notification_force_header=True, @@ -155,6 +161,7 @@ def write(self, vals): if "picking_type_id" in vals: user = self.env.user + # TODO: Odoo BTL - lock for AR if user.has_group("stock_ux.group_restrict_edit_picking_type"): for picking in self: if picking.picking_type_id: diff --git a/stock_ux/models/stock_rule.py b/stock_ux/models/stock_rule.py index c36f0d0d6..32652cf8a 100644 --- a/stock_ux/models/stock_rule.py +++ b/stock_ux/models/stock_rule.py @@ -27,6 +27,7 @@ def _run_pull(self, procurements): # Extract orderpoints from procurements and recompute their qty_to_order_computed # procurement is a namedtuple: # (product_id, product_qty, product_uom, location_id, name, origin, company_id, values) + # TODO: Odoo BTL - lock for AR orderpoints = self.env["stock.warehouse.orderpoint"] for procurement, rule in procurements: # Access values dict from the namedtuple (index 7 or .values attribute) diff --git a/stock_ux/models/stock_warehouse_orderpoint.py b/stock_ux/models/stock_warehouse_orderpoint.py index cb1654fcd..81e5da4c7 100644 --- a/stock_ux/models/stock_warehouse_orderpoint.py +++ b/stock_ux/models/stock_warehouse_orderpoint.py @@ -131,6 +131,7 @@ def write(self, vals): """When archive a replenishment rule set min, max and multiple quantities in 0. """ + # TODO: Odoo BTL - lock for AR if "active" in vals and not vals["active"]: self.write( { @@ -181,6 +182,7 @@ def update_qty_to_order(self): def _cron_compute_rotation(self): """Cron method to compute the rotation of orderpoints.""" + # TODO: Odoo BTL - lock for AR orderpoints = self.with_context(active_test=False).search([]) orderpoints._compute_rotation() return True