Commit 99ef4946 authored by Jérome Perrin's avatar Jérome Perrin

some XXX comments to address

parent 0ad24fe5
......@@ -23,7 +23,8 @@
"\n",
"Once the order has been created, you must change the workflow status to 'planned'. \n",
"\n",
"![Sample Order](http://img.erp5.cn/osoe-simple.sales.order-screenshot?format=png)\n"
"![Sample Order](http://img.erp5.cn/osoe-simple.sales.order-screenshot?format=png)\n",
"XXX Jérome: make sure that simulation is generated by checking future stock on product's stock browser. Please add screenshot. Troubleshooting: make sure trade condition is set properly"
]
},
{
......@@ -77,6 +78,7 @@
"source": [
"# Extract order data from database\n",
"\n",
"XXX Jérome: this step should not be needed anymore. No more hand made SQL, just inventory API.\n",
"In order to create a time series of orders we must create the report of the past orders to be used by the method. So we need to create a new Z SQL Method. You must go to the 'custom' folder in 'portal_skins' (`https://<your_instance_url>/portal_skins/custom/manage`), click in 'Add' and then in 'Z SQL Method'. Use 'SaleOrderModule_zGetStock' as SQL Method ID.\n",
"\n",
"Then you will type the following query:\n",
......@@ -97,6 +99,7 @@
"source": [
"# Exporting the sample data as CSV (extension)\n",
"\n",
"Jérome: XXX can you do that in a python script ?\n",
"To export the sample data as CSV you will navigate to `https://<your_instance_url>/portal_components`, click in the 'Action' box and select 'Add Extension Component'. Use 'extension.erp5.InventoryCsv' as ID and 'InventoryCsv' as reference.\n",
"\n",
"Now you can copy the code below to your extension.\n",
......@@ -107,8 +110,10 @@
" import StringIO\n",
" \n",
" product = self.portal_catalog(title='Test Product', portal_type=\"Product\")[0]\n",
" XXX Jérome: This is not *nexedi* \n",
" nexedi = self.portal_catalog(title='Demo Clothes', portal_type='Organisation')[0]\n",
" columns = ['date', 'quantity']\n",
" XXX Jérome: we should not use getInventoryList without parameters that has no meaning. We should use the API to get the history of movements of a given resource that goes out of a given node \n",
" quantity_list = ([item['date'], item['total_quantity']] for item in self.portal_simulation.getInventoryList()) \n",
" \n",
" csv_file = StringIO.StringIO()\n",
......@@ -127,6 +132,7 @@
"source": [
"# Exporting the sample data as CSV (external method)\n",
"\n",
"Jérome: please read naming conventions and propose a better name.\n",
"Then you will need to create an external method to call your extension and run the export code. Navigate again to the 'custom folder' inside 'portal_skins', click 'Add' and choose 'External Method'. Now choose 'getInventoryCsv' as ID, 'InventoryCsv' as 'Module Name' and 'inventory_csv' as 'Function Name'. Click 'Save changes'."
]
},
......@@ -136,6 +142,7 @@
"source": [
"# Preparing Jupyter\n",
"\n",
"XXX Jérome: this step should be done using slapos and webrunner. \n",
"Now we need to install Jupyter and all the used eggs to process the data localy. Just install the packages using 'pip' as below:\n",
"\n",
"```sh\n",
......@@ -186,6 +193,7 @@
"source": [
"# Fetch the data and create a pandas.TimeSeries\n",
"\n",
"XXX Jérome: at some point we need to use ERP5 integrated jupyter for that \n",
"Now you will need to call your external method to export the orders as a CSV file, write into an in-memory file and use it to create a `pandas.DataFrame`. This will allow you to process the data taking advantage of pandas and numpy C extensions to achieve a very good performance. See the code below."
]
},
......@@ -220,6 +228,7 @@
],
"source": [
"# need ssh tunnel to use this url\n",
"# XXX Jérome: do we need ssh tunnel to use this url ?\n",
"url = 'https://<your_instance_url>/portal_skins/custom/getInventoryCsv'\n",
"response = requests.get(url, auth=('<your_instance_user>', '<your_instance_user_password'))\n",
"csv_file = StringIO()\n",
......@@ -620,4 +629,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
\ 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