-
-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[15.0][IMP]stock_cycle_count: several improvements #1997
Merged
OCA-git-bot
merged 18 commits into
OCA:15.0
from
ForgeFlow:15.0-imp-stock_cycle_count-user_and_date
Dec 3, 2024
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7065ca1
[15.0][IMP] stock_cycle_count: add auto complete into cron
ArnauCForgeFlow e191484
[ADD] stock_cycle_count: line_accuracy in stock move lines
JoanSForgeFlow ab3986c
[IMP] stock_cycle_count: improved inventory_accuracy calculation
ArnauCForgeFlow 232ed7b
[FIX] stock_cyle_count: remove duplicated field location_ids in tree …
JoanSForgeFlow bdc8e31
[IMP] stock_cycle_count: start inv adjustments depending on setting
ArnauCForgeFlow 2e5b1f0
[FIX] stock_cycle_count: prevent creating infinte cycle counts
ArnauCForgeFlow 3980626
[FIX] stock_cycle_count: prefill_counted_quantity zero, counted, false
ArnauCForgeFlow 82bbd01
[FIX] stock_cycle_count: inventory adjustment already adds these fields
ArnauCForgeFlow ed30876
[IMP] stock_cycle_count: added more tests
ArnauCForgeFlow d04fe77
[IMP] stock_cycle_count: Enable edit and cascade updates for responsi…
JoanSForgeFlow d6c95c0
[IMP] stock_cycle_count: added new group by required date
ArnauCForgeFlow a82f01c
[IMP] stock_cycle_count: add multicompany rule
ArnauCForgeFlow bd1e6a6
[IMP] stock_cycle_count: remove auto confirmation logic from the cron
JoanSForgeFlow cddec1e
[FIX] stock_cycle_count: fixed tests since having initial quantity 0 …
ArnauCForgeFlow b8fd2aa
[IMP] stock_cycle_count: Refactor responsible_id sync using compute/i…
JoanSForgeFlow bbba2f8
[IMP] stock_cycle_count: Remove useless filtered
ArnauCForgeFlow 2c9ecf6
[FIX] stock_cycle_count: use company of the location when creating cy…
JoanSForgeFlow cc0320c
[IMP] stock_cycle_count: add rec company_id to domain
ArnauCForgeFlow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2024 ForgeFlow S.L. | ||
# (http://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
_inherit = "stock.move.line" | ||
|
||
line_accuracy = fields.Float( | ||
rousseldenis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
string="Accuracy", | ||
store=True, | ||
) | ||
theoretical_qty = fields.Float(string="Theoretical Quantity", store=True) | ||
counted_qty = fields.Float(string="Counted Quantity", store=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2024 ForgeFlow S.L. | ||
# (http://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
from odoo import models | ||
|
||
|
||
class StockQuant(models.Model): | ||
_inherit = "stock.quant" | ||
|
||
def _apply_inventory(self): | ||
accuracy_dict = {} | ||
theoretical_dict = {} | ||
counted_dict = {} | ||
for rec in self: | ||
if rec.discrepancy_percent > 100: | ||
line_accuracy = 0 | ||
else: | ||
line_accuracy = 1 - (rec.discrepancy_percent / 100) | ||
accuracy_dict[rec.id] = line_accuracy | ||
theoretical_dict[rec.id] = rec.quantity | ||
counted_dict[rec.id] = rec.inventory_quantity | ||
res = super()._apply_inventory() | ||
for rec in self: | ||
record_moves = self.env["stock.move.line"] | ||
moves = record_moves.search( | ||
[ | ||
("product_id", "=", rec.product_id.id), | ||
("lot_id", "=", rec.lot_id.id), | ||
"|", | ||
("location_id", "=", rec.location_id.id), | ||
("location_dest_id", "=", rec.location_id.id), | ||
], | ||
order="create_date asc", | ||
) | ||
move = moves[len(moves) - 1] | ||
move.write( | ||
{ | ||
"line_accuracy": accuracy_dict[rec.id], | ||
"theoretical_qty": theoretical_dict[rec.id], | ||
"counted_qty": counted_dict[rec.id], | ||
} | ||
) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="0"> | ||
<record model="ir.rule" id="stock_cycle_count_comp_rule"> | ||
<field name="name">Stock Cycle Count multi-company</field> | ||
<field name="model_id" ref="model_stock_cycle_count" /> | ||
<field name="global" eval="True" /> | ||
<field | ||
name="domain_force" | ||
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,11 @@ | |
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z 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. | ||
|
@@ -274,7 +275,7 @@ | |
margin-left: 2em ; | ||
margin-right: 2em } | ||
|
||
pre.code .ln { color: grey; } /* line numbers */ | ||
pre.code .ln { color: gray; } /* 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 } | ||
|
@@ -300,7 +301,7 @@ | |
span.pre { | ||
white-space: pre } | ||
|
||
span.problematic { | ||
span.problematic, pre.problematic { | ||
color: red } | ||
|
||
span.section-subtitle { | ||
|
@@ -513,7 +514,9 @@ <h2><a class="toc-backref" href="#toc-entry-13">Contributors</a></h2> | |
<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> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a too broad Exception ?
Moreover, shouldn't we manage the exception in a more elegant manner than 'just' logging ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rousseldenis
You might be right. I implemented it this way because we don't want the cron job to stop running due to a validation error from a location that already has an inventory adjustment in progress.
Do you have any suggestions for a better approach?
Thanks.