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