Skip to content

Commit

Permalink
IMP: bom line capabilitys
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Mar 12, 2024
1 parent 0ee2630 commit 8cd9457
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plm/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
"name": "Product Lifecycle Management",
"version": "16.0.26",
"version": "16.0.27",
"author": "OmniaSolutions",
"website": "https://odooplm.omniasolutions.website",
"category": "Manufacturing/Product Lifecycle Management (PLM)",
Expand Down
5 changes: 2 additions & 3 deletions plm/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ def wrap(*args, **kw):
except Exception as e:
logging.error(e)
return Response(response=f"{e}", status=500)
return wrap


return wrap

class UploadDocument(Controller):

@route('/plm_document_upload/isalive', type='http', auth='none', methods=['GET'], csrf=False)
Expand Down
6 changes: 4 additions & 2 deletions plm/models/mrp_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,12 @@ def recursion(bom_brws_list):
return {'name': _('B.O.M. Lines'),
'res_model': 'mrp.bom.line',
'view_type': 'form',
'view_mode': 'pivot,tree',
'view_mode': 'tree',
'view_id': self.env.ref("plm.plm_mrp_bom_line_summarize_tree").id,
'search_view_id': self.env.ref("plm.plm_grp_by_parent").id,
'type': 'ir.actions.act_window',
'domain': [('id', 'in', bom_line_ids)],
'context': {"group_by": ['bom_id']},
'context': {},
}


Expand Down
12 changes: 12 additions & 0 deletions plm/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ def _related_doc_ids(self):
_('Cutted Compute Type'),
default='none')

product_tag_ids = fields.Many2many(related='product_tmpl_id.product_tag_ids')

def go_to_product(self):
return {'name': _('Product'),
'res_model': 'product.product',
'res_id':self.product_id.id,
'view_type': 'form',
'view_mode': 'form',
'type': 'ir.actions.act_window',
'domain': [('id', 'in', self.product_id.ids)],
}

def plm_sanitize(self, vals):
all_keys = self._fields
if isinstance(vals, dict):
Expand Down
35 changes: 35 additions & 0 deletions plm/views/mrp_extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@
<odoo>
<!-- View customization on MRP -->

<record id="plm_mrp_bom_line_summarize_tree" model="ir.ui.view">
<field name="name">plm.mrp.bom.line.summarize.tree</field>
<field name="model">mrp.bom.line</field>
<field name="arch" type="xml">
<tree>
<field name="product_id"/>
<button name="go_to_product"
icon="fa-external-link"
type="object"
title="Compute Cost"/>
<field name="description"/>
<field name="engineering_revision"/>
<field name="engineering_state"/>
<field name="product_qty"/>
<field name="product_uom_id"/>
<field name="product_tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" />
<field name="source_id" optional="hide"/>
</tree>
</field>
</record>

<record id="plm_grp_by_parent" model="ir.ui.view">
<field name="name">plm.grp.by.parente</field>
<field name="model">mrp.bom.line</field>
<field eval="100" name="priority" />
<field name="arch" type="xml">
<search string="Product line search">
<filter string="Group By Parent" name="grp_by_parent" context="{'group_by':'bom_id'}"/>
<field string="Product" name="product_id"/>
<field string="Description" name="description"/>
<field string="Tags" name="product_tag_ids"/>
</search>
</field>
</record>

<record id="plm_mrp_bom_line_view_form" model="ir.ui.view">
<field name="name">plm.mrp.bom.line.view.form</field>
<field name="model">mrp.bom.line</field>
Expand Down

0 comments on commit 8cd9457

Please sign in to comment.