Skip to content

Commit

Permalink
[IMP] stock_location_flowable: code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC013 committed Dec 14, 2023
1 parent 2fbc12f commit bc7b27e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 44 deletions.
6 changes: 3 additions & 3 deletions mrp_production_batch/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MRP Production Batch
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1924a00a7a430ea70dddb0afa4f5f677fbd5550307a54be384c8a79ddf87faf1
!! source digest: sha256:f8930a819af69ed12083e16e4aad92d80f4f3c8ae272e327418c18ca6fc9768b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -45,15 +45,15 @@ Credits
Authors
~~~~~~~

* NuoBiT Solutions
* S.L.
* NuoBiT Solutions S.L.

Contributors
~~~~~~~~~~~~

* `NuoBiT <https://www.nuobit.com>`_:

* Kilian Niubo <[email protected]>
* Frank Cespedes <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
4 changes: 1 addition & 3 deletions mrp_production_batch/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"name": "MRP Production Batch",
"summary": "Customizations for Oxigen in MRP Production",
"version": "14.0.1.0.0",
"author": "NuoBiT Solutions, S.L.",
"author": "NuoBiT Solutions S.L.",
"website": "https://github.com/nuobit/odoo-addons",
"category": "Manufacturing/Manufacturing",
"depends": ["mrp"],
"installable": True,
"license": "AGPL-3",
"data": [
"security/ir.model.access.csv",
# "data/ir_sequence_data.xml",
"views/mrp_production_batch_views.xml",
"views/mrp_production_views.xml",
"views/stock_picking_views.xml",
Expand Down
4 changes: 2 additions & 2 deletions mrp_production_batch/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def _check_production_to_batch_consistency(self, mrp_productions):
raise ValidationError(

Check warning on line 25 in mrp_production_batch/models/mrp_production.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production.py#L25

Added line #L25 was not covered by tests
_("Some of the selected productions are already done or cancelled")
)
if len(mrp_productions.mapped("picking_type_id")) > 1:
if len(mrp_productions.picking_type_id) > 1:
raise ValidationError(

Check warning on line 29 in mrp_production_batch/models/mrp_production.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production.py#L29

Added line #L29 was not covered by tests
_("Some of the selected productions have different operation types")
)
if len(mrp_productions.mapped("picking_type_id").mapped("warehouse_id")) > 1:
if len(mrp_productions.picking_type_id.warehouse_id) > 1:
raise ValidationError(

Check warning on line 33 in mrp_production_batch/models/mrp_production.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production.py#L33

Added line #L33 was not covered by tests
_("Some of the selected productions have different warehouses")
)
Expand Down
10 changes: 6 additions & 4 deletions mrp_production_batch/models/mrp_production_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging

from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo.exceptions import UserError, ValidationError

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -120,19 +120,21 @@ def _compute_product_qty(self):

def _compute_product_ids(self):
for rec in self:
rec.product_ids = rec.production_ids.mapped("product_id")
rec.product_ids = rec.production_ids.product_id

Check warning on line 123 in mrp_production_batch/models/mrp_production_batch.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production_batch.py#L123

Added line #L123 was not covered by tests

def action_done(self):
self.ensure_one()

Check warning on line 126 in mrp_production_batch/models/mrp_production_batch.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production_batch.py#L126

Added line #L126 was not covered by tests
productions = self.production_ids.filtered(lambda r: r.state != "done")
productions = self.production_ids.filtered(
lambda r: r.state not in ("cancel", "done")
)
len_production = len(productions)
productions_display_name = []

Check warning on line 131 in mrp_production_batch/models/mrp_production_batch.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production_batch.py#L130-L131

Added lines #L130 - L131 were not covered by tests
for production in productions:
try:
production.with_context(

Check warning on line 134 in mrp_production_batch/models/mrp_production_batch.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production_batch.py#L133-L134

Added lines #L133 - L134 were not covered by tests
mrp_production_batch_create=True
).button_mark_done()
except Exception:
except (ValidationError, UserError):
productions_display_name.append(production.display_name)

Check warning on line 138 in mrp_production_batch/models/mrp_production_batch.py

View check run for this annotation

Codecov / codecov/patch

mrp_production_batch/models/mrp_production_batch.py#L137-L138

Added lines #L137 - L138 were not covered by tests
if productions_display_name and len(productions_display_name) == len_production:
message = "The following productions could not be marked as 'done':\n"
Expand Down
29 changes: 0 additions & 29 deletions mrp_production_batch/models/stock_move.py

This file was deleted.

1 change: 1 addition & 0 deletions mrp_production_batch/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* `NuoBiT <https://www.nuobit.com>`_:

* Kilian Niubo <[email protected]>
* Frank Cespedes <[email protected]>
6 changes: 3 additions & 3 deletions mrp_production_batch/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">MRP Production Batch</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1924a00a7a430ea70dddb0afa4f5f677fbd5550307a54be384c8a79ddf87faf1
!! source digest: sha256:f8930a819af69ed12083e16e4aad92d80f4f3c8ae272e327418c18ca6fc9768b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/NuoBiT/odoo-addons/tree/14.0/mrp_production_batch"><img alt="NuoBiT/odoo-addons" src="https://img.shields.io/badge/github-NuoBiT%2Fodoo--addons-lightgray.png?logo=github" /></a></p>
<ul class="simple">
Expand Down Expand Up @@ -398,15 +398,15 @@ <h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>NuoBiT Solutions</li>
<li>S.L.</li>
<li>NuoBiT Solutions S.L.</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.nuobit.com">NuoBiT</a>:<ul>
<li>Kilian Niubo &lt;<a class="reference external" href="mailto:kniubo&#64;nuobit.com">kniubo&#64;nuobit.com</a>&gt;</li>
<li>Frank Cespedes &lt;<a class="reference external" href="mailto:fcespedes&#64;nuobit.com">fcespedes&#64;nuobit.com</a>&gt;</li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit bc7b27e

Please sign in to comment.