-
-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by LoisRForgeFlow
- Loading branch information
Showing
15 changed files
with
552 additions
and
42 deletions.
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( | ||
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,44 @@ | ||
# 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), | ||
] | ||
+ ([("company_id", "=", rec.company_id.id)] if rec.company_id else []), | ||
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> |
Oops, something went wrong.