Commit 5015f5ce authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_trade: getInventoryList will use portal_categories 's uid if section_category is empty

portal.portal_simulation.getInventoryList(section_category='', src__=True)
use query like
AND (`related_stock_section_category_uid_1_category`.`category_uid` = 281(Uid of portal_categories)
parent ee0de96a
result_list = []
if section_category:
kw['section_category'] = section_category
for brain in context.portal_simulation.getCurrentInventoryList(
node_category=node_category,
section_category=section_category,
group_by_resource=True,
group_by_variation=True,
group_by_node=False,
......
......@@ -931,6 +931,20 @@ class TestTradeReports(ERP5ReportTestCase):
self.tic()
def testStockReport_when_section_category_is_empty(self):
self._createInventoryForStockReportTest()
request = self.portal.REQUEST
request.form['at_date'] = DateTime(2006, 4, 4)
request.form['node_category'] = 'site/demo_site_A'
request.form['section_category'] = ''
line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
get_value('default',
render_format='list', REQUEST=self.portal.REQUEST)
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
def testStockReport_old_date(self):
"""
Old date
......
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