[IMP] stock_cycle_count: remove auto confirmation logic from the cron

This commit is contained in:
Joan Sisquella
2024-09-17 13:02:00 +02:00
committed by ArnauCForgeFlow
parent 167a1c42c8
commit c61ba7a0d1
4 changed files with 7 additions and 41 deletions

View File

@@ -150,20 +150,6 @@ class StockWarehouse(models.Model):
try:
whs = self.search([])
whs.action_compute_cycle_count_rules()
today = fields.Date.today()
cycle_counts = self.env["stock.cycle.count"].search(
[("date_deadline", "<=", today), ("state", "=", "draft")]
)
for cycle_count in cycle_counts:
open_cycle_counts = self.env["stock.cycle.count"].search(
[
("location_id", "=", cycle_count.location_id.id),
("state", "=", "open"),
]
)
if open_cycle_counts:
continue
cycle_count.action_create_inventory_adjustment()
except Exception as e:
_logger.info("Error while running stock_cycle_count cron job: %s", str(e))
raise

View File

@@ -8,11 +8,10 @@
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -275,7 +274,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +300,7 @@ span.option {
span.pre {
white-space: pre }
span.problematic, pre.problematic {
span.problematic {
color: red }
span.section-subtitle {
@@ -514,9 +513,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-14">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>

View File

@@ -201,25 +201,6 @@ class TestStockCycleCount(common.TransactionCase):
pre_existing_count.unlink()
# Execute cron for first time
wh.cron_cycle_count()
# There are counts in state open(execution) and not in state draft
open_counts = self.cycle_count_model.search(
[("location_id", "in", locs.ids), ("state", "=", "open")]
)
self.assertTrue(open_counts, "Cycle counts in execution state")
draft_counts = self.cycle_count_model.search(
[("location_id", "in", locs.ids), ("state", "=", "draft")]
)
self.assertFalse(draft_counts, "No Cycle counts in draft state")
# Execute the cron for second time
wh.cron_cycle_count()
# New cycle counts for same location created in draft state
draft_counts = self.cycle_count_model.search(
[("location_id", "in", locs.ids), ("state", "=", "draft")]
)
self.assertTrue(draft_counts, "No Cycle counts in draft state")
# Inventory adjustment only started for cycle counts in open state
self.assertTrue(open_counts.stock_adjustment_ids)
self.assertFalse(draft_counts.stock_adjustment_ids)
# Zero-confirmations:
count = self.cycle_count_model.search(
[

View File

@@ -11,6 +11,7 @@
decoration-muted="state == 'cancelled'"
decoration-info="state == 'draft'"
multi_edit="1"
default_order="date_deadline asc"
>
<field name="name" />
<field name="location_id" />
@@ -126,6 +127,7 @@
domain="[('state','=', 'cancelled')]"
help="Cycle Counts Cancelled"
/>
<separator />
<filter
name="assigned_to_user"
string="Assigned to me"
@@ -169,7 +171,7 @@
<field name="view_mode">tree,form</field>
<field
name="context"
>{'search_default_planned':1,'search_default_execution':1,'search_default_date_deadline':1}</field>
>{'search_default_planned':1,'search_default_execution':1}</field>
</record>
<menuitem