Commit 6ef154f3 authored by Jean-Paul Smets's avatar Jean-Paul Smets

improved by JPS

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@290 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a9c2dd7f
No related merge requests found
......@@ -10,6 +10,8 @@
movement_list = context.getOrderRelatedMovementList()
movement_uid_list = map(lambda o:o.getUid(), movement_list)
if len(movement_uid_list) > 0 :
return context.ProductionOrder_zGetAggregatedMaterialConsumptionList(order_related_movement_uid_list = movement_uid_list, query=kw.get('query', None))
return context.ProductionOrder_zGetAggregatedMaterialConsumptionList(order_related_movement_uid_list = movement_uid_list,
query=kw.get('query', None),
at_date=context.getStartDate().Date())
else :
return []
......@@ -8,7 +8,8 @@ class_name:DeliveryListBrain
class_file:InventoryBrain.py
</dtml-comment>
<params>order_related_movement_uid_list:list
query</params>
query
at_date</params>
SELECT
resource.uid,
resource.path,
......@@ -23,6 +24,8 @@ SELECT
resource.relative_url AS resource_relative_url,
movement.variation_text AS variation_text,
catalog.simulation_state AS simulation_state
<dtml-if at_date>,<dtml-sqlvar at_date type="string" > as at_date
</dtml-if>
<dtml-if query>,<dtml-sqlvar query type="string"> as query
</dtml-if>
FROM
......
......@@ -34,18 +34,18 @@ SELECT
COUNT(DISTINCT resource.title) AS resource_title,
COUNT(DISTINCT resource.relative_url) AS resource_relative_url,
COUNT(DISTINCT movement.variation_text) AS variation_text,
MAX(resource.uid) AS resource_uid
MAX(stock.resource_uid) AS resource_uid
FROM
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
WHERE
catalog.uid = movement.uid
AND catalog.uid = stock.uid
<dtml-if resource>AND (<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> stock.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if>AND movement.is_accountable = 1
AND node.uid = stock.node_uid
AND section.uid = stock.section_uid
AND movement.resource_uid = resource.uid
AND stock.resource_uid = resource.uid
<dtml-if from_date>AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if node_uid>AND stock.node_uid = <dtml-sqlvar node_uid type="int">
......
......@@ -22,7 +22,8 @@ resource_category
omit_simulation
omit_input
omit_output
simulation_state</params>
simulation_state
query</params>
SELECT
SUM(stock.quantity) AS inventory,
node.title AS node_title,
......@@ -35,7 +36,7 @@ SELECT
movement.variation_text AS variation_text,
MAX(catalog.path) AS path
FROM
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if>
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
WHERE
catalog.uid = movement.uid
AND catalog.uid = stock.uid
......@@ -68,7 +69,9 @@ AND resource_membership.uid = resource.uid
</dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0
</dtml-if><dtml-if simulation_state>AND (<dtml-in simulation_state> catalog.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if>GROUP BY
</dtml-if><dtml-if query>AND category.uid = node.uid
AND <dtml-var query></dtml-if>
GROUP BY
stock.node_uid, stock.section_uid, movement.resource_uid, movement.variation_text
ORDER BY
node.title, resource.title, movement.variation_text
\ No newline at end of file
......@@ -20,7 +20,10 @@ node_category
section_category
resource_category
simulation_state
query</params>
query
omit_input
omit_output
omit_simulation</params>
SELECT
catalog.path as path,
catalog.uid as uid,
......@@ -51,7 +54,7 @@ WHERE
AND catalog.uid = stock.uid
AND node.uid = stock.node_uid
AND section.uid = stock.section_uid
AND movement.resource_uid = resource.uid
AND stock.resource_uid = resource.uid
<dtml-if resource>AND (<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if>AND movement.is_accountable = 1
......@@ -60,6 +63,9 @@ AND movement.resource_uid = resource.uid
</dtml-if><dtml-if from_date>AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement"
</dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0
</dtml-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string">
AND node_membership.category_uid = node_c.uid
AND node_membership.base_category_uid = node_bc.uid
......@@ -76,6 +82,6 @@ AND resource_membership.uid = resource.uid
</dtml-if><dtml-if query>AND category.uid = node.uid
AND <dtml-var query></dtml-if>
GROUP BY
movement.delivery_uid, resource.uid, movement.variation_text, node.uid, section.uid
movement.delivery_uid, resource.uid, movement.variation_text, node.uid, section.uid, catalog.simulation_state
ORDER BY
movement.start_date, node.title, resource.title, movement.quantity
\ No newline at end of file
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