Skip to content

Commit

Permalink
Fix stock_release_channel_auto_release backward port to 14
Browse files Browse the repository at this point in the history
  • Loading branch information
TDu committed Jul 4, 2023
1 parent 1761937 commit 2851fbd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions stock_available_to_promise_release/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ class StockPicking(models.Model):
city = fields.Char(related="partner_id.city", store=True)
last_release_date = fields.Datetime()

set_printed_at_release = fields.Boolean(compute="_compute_set_printed_at_release")

@api.depends("move_lines")
def _compute_set_printed_at_release(self):
for picking in self:
picking.set_printed_at_release = not (
any(picking.move_lines.mapped("rule_id.no_backorder_at_release"))
)

@api.depends("move_lines.need_release")
def _compute_need_release(self):
data = self.env["stock.move"].read_group(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
create="0"
>
<field name="release_mode" invisible="1" />
<field name="is_release_allowed" />
<field name="color" />
<field name="name" readonly="1" />
<field name="count_picking_release_ready" />
Expand Down
2 changes: 1 addition & 1 deletion stock_release_channel_auto_release/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Stock Release Channel Auto Release",
"summary": """
Add an automatic release mode to the release channel""",
"version": "16.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def write(self, vals):
res = super().write(vals)
release_mode = vals.get("release_mode")
if release_mode == "auto":
self.invalidate_recordset(["is_auto_release_allowed"])
self.invalidate_cache(["is_auto_release_allowed"])
self.auto_release_all()
return res

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setUpClass(cls):
cls._update_qty_in_location(cls.loc_bin1, cls.product2, 1000.0)

# invalidate cache for computed fields bases on qty in stock
cls.env.invalidate_all()
cls.env["product.product"].invalidate_cache()

@contextmanager
def assert_release_job_enqueued(self, channel):
Expand Down

0 comments on commit 2851fbd

Please sign in to comment.