diff --git a/mrp_bom_line_sequence/__manifest__.py b/mrp_bom_line_sequence/__manifest__.py index 6e391b040..028f2b0cc 100644 --- a/mrp_bom_line_sequence/__manifest__.py +++ b/mrp_bom_line_sequence/__manifest__.py @@ -2,15 +2,14 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - 'name': 'BOM lines with sequence number', - 'summary': 'Manages the order of BOM lines by displaying its sequence', - 'version': '12.0.1.0.0', - 'category': 'Manufacturing Management', - 'author': "Eficent, " - "Odoo Community Association (OCA)", - 'website': 'https://github.com/OCA/manufacture', - 'license': "AGPL-3", - 'depends': ['mrp'], - 'data': ['views/stock_view.xml'], - 'installable': True, + "name": "BOM lines with sequence number", + "summary": "Manages the order of BOM lines by displaying its sequence", + "version": "13.0.1.0.0", + "category": "Manufacturing Management", + "author": "Eficent, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/manufacture", + "license": "AGPL-3", + "depends": ["mrp"], + "data": ["views/stock_view.xml"], + "installable": True, } diff --git a/mrp_bom_line_sequence/models/mrp.py b/mrp_bom_line_sequence/models/mrp.py index 3d9e0df51..10375b146 100644 --- a/mrp_bom_line_sequence/models/mrp.py +++ b/mrp_bom_line_sequence/models/mrp.py @@ -5,30 +5,34 @@ from odoo import api, fields, models class MrpBomLine(models.Model): - _inherit = 'mrp.bom.line' + _inherit = "mrp.bom.line" # re-defines the field to change the default - sequence = fields.Integer(default=9999, string='original sequence') + sequence = fields.Integer(default=9999, string="original sequence") # displays sequence on the stock moves - sequence2 = fields.Integer(help="Shows the sequence in the BOM line.", - string='Sequence', - related='sequence', readonly=False, store=True) + sequence2 = fields.Integer( + help="Shows the sequence in the BOM line.", + string="Sequence", + related="sequence", + readonly=False, + store=True, + ) @api.model def create(self, values): move = super(MrpBomLine, self).create(values) # We do not reset the sequence if we are copying a complete bom - if not self.env.context.get('keep_line_sequence', False): + if not self.env.context.get("keep_line_sequence", False): move.bom_id._reset_sequence() return move class MrpBom(models.Model): - _inherit = 'mrp.bom' + _inherit = "mrp.bom" @api.multi - @api.depends('bom_line_ids') + @api.depends("bom_line_ids") def _compute_max_line_sequence(self): """Allow to know the highest sequence entered in move lines. Then we add 1 to this value for the next sequence, this value is @@ -37,12 +41,11 @@ class MrpBom(models.Model): incremented by 1. (max_sequence + 1) """ for bom in self: - bom.max_line_sequence = ( - max(bom.mapped('bom_line_ids.sequence') or [0]) + 1 - ) + bom.max_line_sequence = max(bom.mapped("bom_line_ids.sequence") or [0]) + 1 - max_line_sequence = fields.Integer(string='Max sequence in lines', - compute='_compute_max_line_sequence') + max_line_sequence = fields.Integer( + string="Max sequence in lines", compute="_compute_max_line_sequence" + ) @api.multi def _reset_sequence(self): @@ -54,5 +57,4 @@ class MrpBom(models.Model): @api.multi def copy(self, default=None): - return super(MrpBom, - self.with_context(keep_line_sequence=True)).copy(default) + return super(MrpBom, self.with_context(keep_line_sequence=True)).copy(default) diff --git a/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst b/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst index 25ac7dbc3..8411ab0a2 100644 --- a/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst +++ b/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst @@ -1 +1 @@ -* Eficent Business and IT Consulting Services S.L. \ No newline at end of file +* Eficent Business and IT Consulting Services S.L.