Skip to content

Commit

Permalink
IMP: add nuw weight filed on bom
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Apr 19, 2024
1 parent 59329eb commit ca7130d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions plm_automatic_weight/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
"""
from . import product_product
from . import mrp_bom
from . import mrp_bom_line
36 changes: 36 additions & 0 deletions plm_automatic_weight/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
##############################################################################
#
# OmniaSolutions, Open Source Management Solution
# Copyright (C) 2010-2011 OmniaSolutions (<http://www.omniasolutions.eu>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

"""
Created on 13 Jun 2016
@author: Daniel Smerghetto
"""
from odoo import models
from odoo import fields


class MrpBomLine(models.Model):
_name = 'mrp.bom.line'
_inherit = 'mrp.bom.line'

product_automatic_compute_selection = fields.Selection(related="product_id.automatic_compute_selection")

13 changes: 13 additions & 0 deletions plm_automatic_weight/views/mrp_bom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
<field name="binding_model_id" ref="mrp.model_mrp_bom"/>
<field name="code">env['mrp.bom'].browse(env.context.get('active_ids', [])).force_compute_bom_weight()</field>
</record>

<record id="plm_aw_mrp_bom_form_view" model="ir.ui.view">
<field name="name">plm.aw.mrp.bom.form.view</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
<field name="type">form</field>
<field name="priority" eval="16"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='bom_line_ids']/tree/field[last()]" position="after">
<field name="product_automatic_compute_selection" optional="hide"/>
</xpath>
</field>
</record>
</odoo>

0 comments on commit ca7130d

Please sign in to comment.