Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
erp5
Commits
c908095b
Commit
c908095b
authored
Mar 27, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stock report: use high level inventory API and small cleanups
parent
649f31fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
45 deletions
+25
-45
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteCurrentStockList.xml
...ortal_skins/erp5_trade/Base_getBySiteCurrentStockList.xml
+25
-45
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteCurrentStockList.xml
View file @
c908095b
...
@@ -52,54 +52,34 @@
...
@@ -52,54 +52,34 @@
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
site = context.portal_categories.site.restrictedTraverse(site)\n
if group:\n
group = context.portal_categories.group.restrictedTraverse(group)\n
else:\n
group = None\n
\n
if group is not None:\n
kw[\'stock_section_category_uid\'] = group.getUid()\n
\n
def mycmp(line_a, line_b):\n
"""\n
Compare 2 lines and sort them according to\n
sort_on parameter.\n
"""\n
\n
result = cmp(line_a.getResourceReference(), line_b.getResourceReference())\n
if result == 0:\n
result = cmp(line_a.variation_text, line_b.variation_text)\n
if result == 0:\n
result = cmp(line_a.resource_title, line_b.resource_title)\n
return result\n
result_list = []\n
result_list = []\n
for x in context.portal_simulation.getCurrentInventoryList(\n
for brain in context.portal_simulation.getCurrentInventoryList(\n
stock_node_category_uid=site.getUid(),\n
node_category=site,\n
group_by_resource=1,\n
section_category=group,\n
group_by_variation=1,\n
group_by_resource=True,\n
group_by_node=0,\n
group_by_variation=True,\n
group_by_node=False,\n
at_date=at_date,\n
at_date=at_date,\n
# resource_portal_type= does not work with cells (because resource is acquired from line)\n
# resource_portal_type= does not work with cells (because resource is acquired from line)\n
resourceType=context.getPortalProductTypeList(), **kw):\n
resourceType=context.getPortalProductTypeList(),\n
if positive_stock and negative_stock and not zero_stock and x.inventory == 0:\n
**kw):\n
result_list.append(x)\n
\n
if positive_stock and not negative_stock and zero_stock and x.inventory <0:\n
if positive_stock and negative_stock and not zero_stock and brain.inventory == 0:\n
result_list.append(x)\n
result_list.append(brain)\n
if negative_stock and zero_stock and not positive_stock and x.inventory >
0:\n
if positive_stock and not negative_stock and zero_stock and brain.inventory <0:\n
result_list.append(x)\n
result_list.append(brain)\n
if positive_stock and not negative_stock and not zero_stock and x.inventory
<
=0:\n
if negative_stock and zero_stock and not positive_stock and brain.inventory >
0:\n
result_list.append(x)\n
result_list.append(brain)\n
if negative_stock and not positive_stock and not zero_stock and x.inventory >=0:\n
if positive_stock and not negative_stock and not zero_stock and brain.inventory
<
=0:\n
result_list.append(x)\n
result_list.append(brain)\n
if zero_stock and not positive_stock and not negative_stock and x.inventory!=0:\n
if negative_stock and not positive_stock and not zero_stock and brain.inventory >=0:\n
result_list.append(x)\n
result_list.append(brain)\n
if zero_stock and not positive_stock and not negative_stock and brain.inventory!=0:\n
result_list.append(brain)\n
if not positive_stock and not negative_stock and not zero_stock:\n
if not positive_stock and not negative_stock and not zero_stock:\n
result_list.append(
x
)\n
result_list.append(
brain
)\n
\n
\n
result_list = list(result_list)\n
return sorted(result_list, key=lambda brain: (brain.getResourceReference(), brain.getResourceTitle(), brain.variation_text))\n
result_list.sort(cmp=mycmp)\n
return result_list\n
]]>
</string>
</value>
]]>
</string>
</value>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment