Commit 4694e125 authored by Sebastien Robin's avatar Sebastien Robin

mrp: show production planning also on ressources

parent 577da5f3
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>resource_view_manufacturing_gantt</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Manufacturing Gantt</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ManufacturingOrderModule_viewGantt</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>resource_view_manufacturing_gantt</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Manufacturing Gantt</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ManufacturingOrderModule_viewGantt</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
configuration_dict = {'portal_type': ["Manufacturing Order", "Manufacturing Execution"]}
portal = context.getPortalObject()
if context.getPortalType() in portal.getPortalResourceTypeList():
# only show production related to current resource
delivery_uid_set = set()
for line in portal.portal_catalog(portal_type="Manufacturing Execution Line",
query=NegatedQuery(Query(simulation_state=["draft", "cancelled", "delivered"])),
default_resource_uid=context.getUid(),
select_dict={"parent_uid": None}):
delivery_uid_set.add(line.parent_uid)
# to make sure to filter even if nothing match
delivery_uid_set.add(0)
configuration_dict["delivery_uid_list"] = [x for x in delivery_uid_set]
return configuration_dict
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ManufacturingOrderModule_getGanttConfigurationDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: {\'portal_type\': ["Manufacturing Order", "Manufacturing Execution"],}</string> </value> <value> <string>python: here.ManufacturingOrderModule_getGanttConfigurationDict()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
Component | resource_view_manufacturing_gantt
Manufacturing Execution Cell | view Manufacturing Execution Cell | view
Manufacturing Execution Line | option_view Manufacturing Execution Line | option_view
Manufacturing Execution Line | quantity_view Manufacturing Execution Line | quantity_view
...@@ -22,6 +23,7 @@ Manufacturing Order | production_order_operation_consumption ...@@ -22,6 +23,7 @@ Manufacturing Order | production_order_operation_consumption
Manufacturing Order | profile_view Manufacturing Order | profile_view
Manufacturing Order | view Manufacturing Order | view
Manufacturing Order | view_stock Manufacturing Order | view_stock
Product | resource_view_manufacturing_gantt
Production Order Cell | view Production Order Cell | view
Production Order Line | jump_to_transformation Production Order Line | jump_to_transformation
Production Order Line | price_view Production Order Line | price_view
......
...@@ -57,10 +57,14 @@ ...@@ -57,10 +57,14 @@
.push(function (gantt_widget) { .push(function (gantt_widget) {
// First search all production report not finished to find out the // First search all production report not finished to find out the
// list of production orders still having work on them // list of production orders still having work on them
var query; var query, delivery_uid_list;
gadget.property_dict.gantt_widget = gantt_widget; gadget.property_dict.gantt_widget = gantt_widget;
console.log("gantt_widget", gantt_widget); console.log("gantt_widget", gantt_widget);
query = 'portal_type:="Manufacturing Execution" AND NOT simulation_state: ("draft", "cancelled", "delivered")'; query = 'portal_type:="Manufacturing Execution" AND NOT simulation_state: ("draft", "cancelled", "delivered")';
delivery_uid_list = option_dict.delivery_uid_list;
if ((delivery_uid_list !== undefined) && (delivery_uid_list.length > 0)) {
query = query + ' AND uid: (' + delivery_uid_list.join(', ') + ')';
}
return gadget.jio_allDocs({ return gadget.jio_allDocs({
query: query, query: query,
limit: 10000, limit: 10000,
...@@ -69,8 +73,11 @@ ...@@ -69,8 +73,11 @@
}); });
}) })
.push(function (delivery_list) { .push(function (delivery_list) {
// try to search for other manufacturing execution having same causality as
// other manufacturing execution already found
var causality_uid_list = [0], // Initiliaze with 0 to make sure to have at least one uid to search for var causality_uid_list = [0], // Initiliaze with 0 to make sure to have at least one uid to search for
i, delivery, query, empty_causality_delivery_list = []; i, delivery, query, empty_causality_delivery_list = [],
delivery_uid_list;
delivery_list = delivery_list.data.rows; delivery_list = delivery_list.data.rows;
for (i = 0; i < delivery_list.length; i = i + 1) { for (i = 0; i < delivery_list.length; i = i + 1) {
...@@ -86,6 +93,11 @@ ...@@ -86,6 +93,11 @@
query = 'portal_type:="Manufacturing Execution" AND causality_uid: (' + causality_uid_list.join(', ') + ') AND NOT simulation_state: ("draft", "cancelled")'; query = 'portal_type:="Manufacturing Execution" AND causality_uid: (' + causality_uid_list.join(', ') + ') AND NOT simulation_state: ("draft", "cancelled")';
console.log("QUERY", query); console.log("QUERY", query);
gadget.property_dict.empty_causality_delivery_list = empty_causality_delivery_list; gadget.property_dict.empty_causality_delivery_list = empty_causality_delivery_list;
delivery_uid_list = option_dict.delivery_uid_list;
// No need to get more
if ((delivery_uid_list !== undefined) && (delivery_uid_list.length > 0)) {
query = query + ' AND uid: (' + delivery_uid_list.join(', ') + ')';
}
return gadget.jio_allDocs({ return gadget.jio_allDocs({
query: query, query: query,
limit: 10000, limit: 10000,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment