Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
19a1ca78
Commit
19a1ca78
authored
Jun 22, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug on production order material consumption tab.
parent
be4e2d62
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
152 deletions
+76
-152
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml
...s/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml
+0
-136
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getMaterialFutureInventoryList.xml
...p5_mrp/ProductionOrder_getMaterialFutureInventoryList.xml
+65
-3
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_viewMaterialConsumption/listbox.xml
...5_mrp/ProductionOrder_viewMaterialConsumption/listbox.xml
+7
-12
bt5/erp5_mrp/bt/change_log
bt5/erp5_mrp/bt/change_log
+3
-0
bt5/erp5_mrp/bt/revision
bt5/erp5_mrp/bt/revision
+1
-1
No files found.
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml
deleted
100644 → 0
View file @
be4e2d62
<?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>
_body
</string>
</key>
<value>
<string>
"""Returns list of resources\' inventories used in consumption for production\n
\n
Args:\n
- omit_order_resources [default: 1]\n
Do not show resources, which are on order lines.\n
"""\n
if omit_order_resources:\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
from Products.ZSQLCatalog.SQLCatalog import NegatedQuery\n
\n
ignored_resource_uid_list = [q.getResourceUid() for q in context.getMovementList() if q.getResourceUid() is not None]\n
kwargs[\'query\'] = NegatedQuery(Query(operator=\'IN\',**{\'stock.resource_uid\': ignored_resource_uid_list}))\n
\n
kwargs[\'group_by_date\'] = 1\n
kwargs[\'group_by_node\'] = 1\n
kwargs[\'group_by_variation\'] = 1\n
kwargs[\'group_by_resource\'] = 1\n
kwargs[\'section_uid\'] = context.getDestinationSectionUid()\n
\n
inventory_dict = {}\n
for inventory in context.portal_simulation.getFutureInventoryList(*args,**kwargs):\n
inventory_dict[inventory.getResourceUid(), \\\n
tuple(sorted(inventory.getVariationCategoryList())), \\\n
inventory.getDestination()] = inventory\n
\n
result_list = inventory_dict.values()\n
consumption_dict = {}\n
for movement in context.getMovementList():\n
movement_quantity = movement.getQuantity()\n
movement_destination = movement.getDestination()\n
\n
transformation = movement.getSpecialiseValue()\n
if transformation is not None:\n
transformation_line_list = transformation.objectValues()\n
else:\n
transformation_line_list = ()\n
\n
for material in transformation_line_list:\n
material_resource_uid = material.getResourceUid()\n
if not material_resource_uid:\n
continue\n
\n
inventory_dict_key = material_resource_uid, \\\n
tuple(sorted(material.getVariationCategoryList())), \\\n
movement_destination\n
\n
quantity = material.getQuantity()\n
\n
try:\n
obj = inventory_dict[inventory_dict_key]\n
except KeyError:\n
obj = material\n
result_list.append(obj)\n
else:\n
inventory_quantity_unit = obj.getQuantityUnit()\n
quantity_unit = material.getQuantityUnit()\n
if quantity_unit != inventory_quantity_unit:\n
quantity = material.getResourceValue().convertQuantity(quantity,\n
quantity_unit,\n
inventory_quantity_unit)\n
\n
if quantity:\n
consumption_dict[obj.getUid()] = quantity * movement_quantity\n
\n
context.REQUEST.set(\'consumption_dict\', consumption_dict)\n
return result_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
omit_order_resources=1,*args,**kwargs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ProductionOrder_getConsumptionMovementList
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getMaterialFutureInventoryList.xml
View file @
19a1ca78
...
...
@@ -50,9 +50,71 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""Returns list of materials\' inventories used in consumption for production"""\n
kwargs[\'resource_portal_type\'] = context.getPortalObject().getPortalProductTypeList()\n
return context.ProductionOrder_getConsumptionMovementList(*args,**kwargs)\n
<value>
<string>
"""Returns list of resources\' inventories used in consumption for production\n
Show only resources which are defined in transformation.\n
"""\n
movement_list = context.getMovementList()\n
transformation_line_list_dict = {}\n
consumed_resource_list = []\n
for movement in movement_list:\n
transformation = movement.getSpecialiseValue()\n
if transformation is not None:\n
transformation_line_list = transformation.objectValues()\n
transformation_line_list_dict[movement] = transformation_line_list\n
for transformation_line in transformation_line_list:\n
transformation_resource = transformation_line.getResourceValue()\n
if transformation_resource is not None:\n
consumed_resource_list.append(transformation_resource)\n
else:\n
transformation_line_list_dict[movement] = ()\n
\n
if not consumed_resource_list:\n
return ()\n
\n
kwargs[\'resource\'] = [resource.getRelativeUrl() for resource in consumed_resource_list]\n
kwargs[\'group_by_section\'] = 0\n
kwargs[\'group_by_node\'] = 1\n
kwargs[\'group_by_variation\'] = 1\n
kwargs[\'section_uid\'] = context.getSourceSectionUid()\n
\n
inventory_dict = {}\n
for inventory in context.portal_simulation.getFutureInventoryList(*args,**kwargs):\n
inventory_dict[inventory.resource_relative_url,\n
inventory.variation_text,\n
inventory.node_relative_url] = inventory\n
\n
result_list = inventory_dict.values()\n
consumption_dict = {}\n
for movement in movement_list:\n
for material in transformation_line_list_dict[movement]:\n
material_resource = material.getResource()\n
if material_resource is None:\n
continue\n
\n
inventory_dict_key = (material_resource,\n
\'\\n\'.join(sorted(material.getVariationCategoryList())),\n
movement.getSource())\n
\n
quantity = material.getQuantity()\n
\n
try:\n
obj = inventory_dict[inventory_dict_key]\n
except KeyError:\n
obj = material\n
result_list.append(obj)\n
else:\n
inventory_quantity_unit = obj.getQuantityUnit()\n
quantity_unit = material.getQuantityUnit()\n
if quantity_unit != inventory_quantity_unit:\n
quantity = material.getResourceValue().convertQuantity(quantity,\n
quantity_unit,\n
inventory_quantity_unit)\n
\n
if quantity:\n
consumption_dict[obj.getUid()] = quantity * (movement.getQuantity() or 0)\n
\n
context.REQUEST.set(\'consumption_dict\', consumption_dict)\n
return result_list\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_viewMaterialConsumption/listbox.xml
View file @
19a1ca78
...
...
@@ -11,7 +11,7 @@
<value>
<list>
<string>
columns
</string>
<string>
editable_column
s
</string>
<string>
default_param
s
</string>
<string>
list_action
</string>
<string>
list_method
</string>
<string>
selection_name
</string>
...
...
@@ -96,10 +96,6 @@
<string>
consumption_item
</string>
<string>
Consumption
</string>
</tuple>
<tuple>
<string>
quantity_unit_item
</string>
<string>
Unit
</string>
</tuple>
<tuple>
<string>
getCurrentInventory
</string>
<string>
Current
</string>
...
...
@@ -112,18 +108,17 @@
<string>
getFutureInventory
</string>
<string>
Future
</string>
</tuple>
<tuple>
<string>
quantity_unit_item
</string>
<string>
Unit
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
editable_column
s
</string>
</key>
<key>
<string>
default_param
s
</string>
</key>
<value>
<list>
<tuple>
<string>
movement.start_date
</string>
<string>
movement.start_date
</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
...
...
bt5/erp5_mrp/bt/change_log
View file @
19a1ca78
2011-06-22 yusei
* Fix bug on production order material consumption tab.
2011-06-15 yusei
* production order movement may not have specialise category value.
...
...
bt5/erp5_mrp/bt/revision
View file @
19a1ca78
463
\ No newline at end of file
464
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment