diff --git a/mrp_production_batch/README.rst b/mrp_production_batch/README.rst index fc202c230..7acc3ae06 100644 --- a/mrp_production_batch/README.rst +++ b/mrp_production_batch/README.rst @@ -2,12 +2,12 @@ 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 @@ -46,7 +46,6 @@ Authors ~~~~~~~ * NuoBiT Solutions -* S.L. Contributors ~~~~~~~~~~~~ @@ -54,6 +53,7 @@ Contributors * `NuoBiT `_: * Kilian Niubo + * Frank Cespedes Maintainers ~~~~~~~~~~~ diff --git a/mrp_production_batch/__manifest__.py b/mrp_production_batch/__manifest__.py index baf0f9a46..1bb155405 100644 --- a/mrp_production_batch/__manifest__.py +++ b/mrp_production_batch/__manifest__.py @@ -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", "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", diff --git a/mrp_production_batch/models/mrp_production.py b/mrp_production_batch/models/mrp_production.py index ae47a4867..10ce5aeb8 100644 --- a/mrp_production_batch/models/mrp_production.py +++ b/mrp_production_batch/models/mrp_production.py @@ -25,11 +25,11 @@ def _check_production_to_batch_consistency(self, mrp_productions): raise ValidationError( _("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( _("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( _("Some of the selected productions have different warehouses") ) diff --git a/mrp_production_batch/models/mrp_production_batch.py b/mrp_production_batch/models/mrp_production_batch.py index e51929569..e773b8516 100644 --- a/mrp_production_batch/models/mrp_production_batch.py +++ b/mrp_production_batch/models/mrp_production_batch.py @@ -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__) @@ -120,11 +120,13 @@ 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 def action_done(self): self.ensure_one() - 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 = [] for production in productions: @@ -132,7 +134,7 @@ def action_done(self): production.with_context( mrp_production_batch_create=True ).button_mark_done() - except Exception: + except (ValidationError, UserError): productions_display_name.append(production.display_name) if productions_display_name and len(productions_display_name) == len_production: message = "The following productions could not be marked as 'done':\n" diff --git a/mrp_production_batch/models/stock_move.py b/mrp_production_batch/models/stock_move.py deleted file mode 100644 index eb205b74d..000000000 --- a/mrp_production_batch/models/stock_move.py +++ /dev/null @@ -1,29 +0,0 @@ -# # # Copyright NuoBiT Solutions - Kilian Niubo -# # # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -# from odoo import _, fields, models -# from odoo.exceptions import ValidationError -# -# -# class StockMove(models.Model): -# _inherit = "stock.move" -# -# production_batch_id = fields.Many2one( -# comodel_name="mrp.production.batch", -# string="Batch Production", -# readonly=True, -# ondelete="restrict", -# ) -# -# def mrp_production_batch_create_wizard_action(self): -# model = self.env.context.get("active_model") -# mrp_productions = self.env[model].browse(self.env.context.get("active_ids")) -# if not mrp_productions: -# raise ValidationError(_("No productions selected")) -# self.env["mrp.production.batch"].create( -# { -# "creation_date": str(fields.Datetime.now()), -# "production_ids": [ -# (6, 0, mrp_productions.ids), -# ], -# } -# ) diff --git a/mrp_production_batch/readme/CONTRIBUTORS.rst b/mrp_production_batch/readme/CONTRIBUTORS.rst index 7e22de318..5c0d390af 100644 --- a/mrp_production_batch/readme/CONTRIBUTORS.rst +++ b/mrp_production_batch/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * `NuoBiT `_: * Kilian Niubo + * Frank Cespedes diff --git a/mrp_production_batch/static/description/index.html b/mrp_production_batch/static/description/index.html index 746120282..c8a583a30 100644 --- a/mrp_production_batch/static/description/index.html +++ b/mrp_production_batch/static/description/index.html @@ -367,7 +367,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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 NuoBiT/odoo-addons