Commit 19bb5fcb authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_trade: ignore node if if's not defined

parent 6b1cf3e6
...@@ -6,20 +6,23 @@ node_uid = context.getDestinationUid() ...@@ -6,20 +6,23 @@ node_uid = context.getDestinationUid()
valuation_method = context.getValuationMethod() valuation_method = context.getValuationMethod()
relative_url = context.getRelativeUrl() relative_url = context.getRelativeUrl()
at_date = context.getAtDate() at_date = context.getAtDate()
kw = {
parameter_dict = {
"section_uid": section_uid, "section_uid": section_uid,
"node_uid": node_uid,
"group_by_resource": 1, "group_by_resource": 1,
"group_by_variation": 1, "group_by_variation": 1,
"resourceType": portal.getPortalProductTypeList(), "resourceType": portal.getPortalProductTypeList(),
"at_date": at_date "at_date": at_date
} }
if node_uid:
parameter_dict['node_uid'] = node_uid
product_line = context.getProductLine() product_line = context.getProductLine()
if product_line: if product_line:
kw['resource_category'] = 'product_line/%s' % product_line parameter_dict['resource_category'] = 'product_line/%s' % product_line
inventory_list = getCurrentInventoryList(**kw) inventory_list = getCurrentInventoryList(**parameter_dict)
line_tag = '%s:lineUpdateTotalAssetPrice' % relative_url line_tag = '%s:lineUpdateTotalAssetPrice' % relative_url
#only after all calculation are finished then change report state #only after all calculation are finished then change report state
...@@ -31,28 +34,22 @@ for inventory in inventory_list: ...@@ -31,28 +34,22 @@ for inventory in inventory_list:
total_quantity = inventory.total_quantity, total_quantity = inventory.total_quantity,
total_asset_price=0 total_asset_price=0
) )
parameter_dict = {
"section_uid": section_uid,
"valuation_method": valuation_method,
"variation_text": inventory.variation_text,
"resource_uid": inventory.resource_uid,
"at_date": at_date,
"is_accountable": 1
}
if node_uid:
parameter_dict['node_uid'] = node_uid
inventory_report_line.activate( inventory_report_line.activate(
tag = line_tag tag = line_tag
).InventoryReportLine_updateTotalAssetPrice( ).InventoryReportLine_updateTotalAssetPrice(**parameter_dict)
section_uid = section_uid,
node_uid = node_uid,
valuation_method = valuation_method,
variation_text = inventory.variation_text,
resource_uid = inventory.resource_uid,
at_date = at_date,
is_accountable = 1
)
inventory_report_line.activate( inventory_report_line.activate(
tag = line_tag tag = line_tag
).InventoryReportLine_createMovementHistoryCellList( ).InventoryReportLine_createMovementHistoryCellList(**parameter_dict)
section_uid = section_uid,
node_uid = node_uid,
valuation_method = valuation_method,
variation_text = inventory.variation_text,
resource_uid = inventory.resource_uid,
at_date = at_date,
is_accountable = 1
)
tag = '%s:updateTotalAssetPrice' % relative_url tag = '%s:updateTotalAssetPrice' % relative_url
context.activate(after_tag=line_tag, tag=tag).InventoryReport_updateTotalAssetPrice() context.activate(after_tag=line_tag, tag=tag).InventoryReport_updateTotalAssetPrice()
......
...@@ -52,6 +52,14 @@ ...@@ -52,6 +52,14 @@
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>InventoryReport_recordProductStock</string> </value> <value> <string>InventoryReport_recordProductStock</string> </value>
......
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