[MIG] mrp_usability to v14
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2020 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
{
|
||||
'name': 'MRP Usability',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Manufacturing',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Usability improvements on manufacturing',
|
||||
@@ -13,9 +12,9 @@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['mrp'],
|
||||
'data': [
|
||||
'views/mrp_views.xml',
|
||||
'views/product_views.xml',
|
||||
'report/mrp_report.xml'
|
||||
'views/mrp_production.xml',
|
||||
'views/product_template.xml',
|
||||
# 'report/mrp_report.xml' # TODO
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import mrp, product
|
||||
from . import mrp_production
|
||||
from . import product
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2020 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -8,8 +8,8 @@ from odoo import api, models
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
_order = 'id desc'
|
||||
|
||||
# Method used by the report, inherited in this module
|
||||
@api.model
|
||||
def get_stock_move_sold_out_report(self, move):
|
||||
lines = move.active_move_line_ids
|
||||
@@ -11,34 +11,30 @@ class ProductTemplate(models.Model):
|
||||
"""Replace native action `template_open_bom` to distinguish if we will display
|
||||
only one BoM form or a list of BoMs."""
|
||||
self.ensure_one()
|
||||
|
||||
act_window_xml_id = "mrp.mrp_bom_form_action"
|
||||
act_window = self.env.ref(act_window_xml_id).read()[0]
|
||||
if self.bom_count > 1:
|
||||
act_window["context"] = {
|
||||
"default_product_tmpl_id": self.id,
|
||||
"search_default_product_tmpl_id": self.id,
|
||||
}
|
||||
if self.bom_count == 1:
|
||||
action = self.env.ref("mrp.mrp_bom_form_action").read()[0]
|
||||
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
||||
action.update({
|
||||
"context": {"default_product_tmpl_id": self.id},
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom.id,
|
||||
})
|
||||
else:
|
||||
act_window["context"] = {"default_product_tmpl_id": self.id}
|
||||
act_window["views"] = [(self.env.ref("mrp.mrp_bom_form_view").id, "form")]
|
||||
act_window["res_id"] = (
|
||||
self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)]).id
|
||||
)
|
||||
|
||||
return act_window
|
||||
action = self.env.ref("mrp.template_open_bom").read()[0]
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = "product.product"
|
||||
|
||||
def action_view_bom(self):
|
||||
res = super().action_view_bom()
|
||||
|
||||
bom_target_ids = self.env["mrp.bom"].search(res["domain"])
|
||||
|
||||
action = super().action_view_bom()
|
||||
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
||||
if len(bom_target_ids) == 1:
|
||||
res["views"] = [(self.env.ref("mrp.mrp_bom_form_view").id, "form")]
|
||||
res["res_id"] = bom_target_ids[0].id
|
||||
|
||||
return res
|
||||
action.update({
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom_target_ids[0].id,
|
||||
})
|
||||
return action
|
||||
|
||||
32
mrp_usability/views/mrp_production.xml
Normal file
32
mrp_usability/views/mrp_production.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2016 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="mrp_production_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.mrp.production.form</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='miscellaneous']/group/group/field[@name='location_src_id']" position="replace"/>
|
||||
<xpath expr="//page[@name='miscellaneous']/group/group/field[@name='location_dest_id']" position="replace"/>
|
||||
<field name="bom_id" position="after">
|
||||
<field name="location_src_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
</field>
|
||||
<xpath expr="//page[@name='miscellaneous']/group/group/field[@name='date_deadline']" position="after">
|
||||
<field name="date_start"/>
|
||||
<field name="date_finished"/>
|
||||
</xpath>
|
||||
<button name="action_cancel" type="object" attrs="{'invisible': ['|', '|', ('id', '=', False), ('state', 'in', ('done', 'cancel')), ('confirm_cancel', '=', True)]}" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to cancel this manufacturing order?</attribute>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2016 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="mrp_production_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.mrp.production.form</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page/group/group[@groups='stock.group_stock_multi_locations']/field[@name='location_src_id']" position="replace"/>
|
||||
<xpath expr="//page/group/group[@groups='stock.group_stock_multi_locations']/field[@name='location_dest_id']" position="replace"/>
|
||||
<field name="routing_id" position="after">
|
||||
<field name="location_src_id" domain="[('usage','=','internal')]" attrs="{'readonly': [('has_moves', '=', True)]}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" domain="[('usage','=','internal')]" attrs="{'readonly': [('has_moves', '=', True)]}" groups="stock.group_stock_multi_locations"/>
|
||||
</field>
|
||||
<field name="availability" position="after">
|
||||
<field name="date_start"/>
|
||||
<field name="date_finished"/>
|
||||
</field>
|
||||
<button name="action_cancel" type="object" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to cancel this manufacturing order?</attribute>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="origin" position="after">
|
||||
<field name="production_id"/>
|
||||
<field name="raw_material_production_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_tree_view" model="ir.ui.view">
|
||||
<field name="model">mrp.bom</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="routing_id" position="after">
|
||||
<field name="type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_mrp_bom_filter" model="ir.ui.view">
|
||||
<field name="model">mrp.bom</field>
|
||||
<field name="inherit_id" ref="mrp.view_mrp_bom_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<group expand="0" position="inside">
|
||||
<filter string="Type" context="{'group_by': 'type'}" name="type_groupby"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
16
mrp_usability/views/product_template.xml
Normal file
16
mrp_usability/views/product_template.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="product_template_form_view_bom_button" model="ir.ui.view">
|
||||
<field name="name">product.template.procurement</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="mrp.product_template_form_view_bom_button" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='bom_count']/.." position="attributes">
|
||||
<attribute name="type">object</attribute>
|
||||
<attribute name="name">action_view_bom</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="product_template_form_view_bom_button" model="ir.ui.view">
|
||||
<field name="name">product.template.procurement</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="mrp.product_template_form_view_bom_button" />
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<xpath expr="//field[@name='bom_count']/.." position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='bom_count']/.." position="after">
|
||||
<button class="oe_stat_button" name="action_view_bom" type="object"
|
||||
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
|
||||
icon="fa-flask">
|
||||
<field string="Bill of Materials" name="bom_count"
|
||||
widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
21
mrp_usability/views/stock_move.xml
Normal file
21
mrp_usability/views/stock_move.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2016-2020 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="origin" position="after">
|
||||
<field name="production_id"/>
|
||||
<field name="raw_material_production_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user