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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
erp5
Commits
03b97d72
Commit
03b97d72
authored
Feb 19, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: available to create stock report for different period
parent
5015f5ce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
370 additions
and
5 deletions
+370
-5
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
...teItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
+8
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
...eItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
+2
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite.xml
...em/portal_skins/erp5_trade/Base_viewStockReportBySite.xml
+1
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite/listbox.xml
...l_skins/erp5_trade/Base_viewStockReportBySite/listbox.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite/your_simulation_period.xml
...ade/Base_viewStockReportBySite/your_simulation_period.xml
+160
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog.xml
...tal_skins/erp5_trade/Base_viewStockReportBySiteDialog.xml
+1
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_simulation_period.xml
...se_viewStockReportBySiteDialog/your_simulation_period.xml
+145
-0
product/ERP5/tests/testTradeReports.py
product/ERP5/tests/testTradeReports.py
+52
-1
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySite
Current
StockList.py
→
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
View file @
03b97d72
result_list
=
[]
inventory_list_method_dict
=
{
'current'
:
'getCurrentInventoryList'
,
'future'
:
'getFutureInventoryList'
,
'available'
:
'getAvailableInventoryList'
,
}
if
section_category
:
kw
[
'section_category'
]
=
section_category
for
brain
in
context
.
portal_simulation
.
getCurrentInventoryList
(
for
brain
in
getattr
(
context
.
portal_simulation
,
inventory_list_method_dict
[
simulation_period
])(
node_category
=
node_category
,
group_by_resource
=
True
,
group_by_variation
=
True
,
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySite
Current
StockList.xml
→
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
View file @
03b97d72
...
...
@@ -50,11 +50,11 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
at_date=None, node_category=None, section_category=None, positive_stock=None, negative_stock=None, zero_stock=None, **kw
</string>
</value>
<value>
<string>
at_date=None, node_category=None, section_category=None, positive_stock=None, negative_stock=None, zero_stock=None,
simulation_period="current",
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getBySite
Current
StockList
</string>
</value>
<value>
<string>
Base_getBySiteStockList
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite.xml
View file @
03b97d72
...
...
@@ -102,6 +102,7 @@
<string>
your_node_category
</string>
<string>
your_section_category
</string>
<string>
your_at_date
</string>
<string>
your_simulation_period
</string>
</list>
</value>
</item>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite/listbox.xml
View file @
03b97d72
...
...
@@ -212,7 +212,7 @@
<dictionary>
<item>
<key>
<string>
method_name
</string>
</key>
<value>
<string>
Base_getBySite
Current
StockList
</string>
</value>
<value>
<string>
Base_getBySiteStockList
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite/your_simulation_period.xml
0 → 100644
View file @
03b97d72
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
items
</string>
<string>
size
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_simulation_period
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_list_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<list>
<tuple>
<string>
Current
</string>
<string>
current
</string>
</tuple>
<tuple>
<string>
Future
</string>
<string>
future
</string>
</tuple>
<tuple>
<string>
Available
</string>
<string>
available
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Simulation Period
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
request/simulation_period
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: [(context.Base_translateString(x), y) for x, y in field.get_orig_value(\'items\')]
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog.xml
View file @
03b97d72
...
...
@@ -96,6 +96,7 @@
<string>
your_node_category
</string>
<string>
your_section_category
</string>
<string>
your_at_date
</string>
<string>
your_simulation_period
</string>
<string>
your_portal_skin
</string>
<string>
your_format
</string>
<string>
your_deferred_style
</string>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_simulation_period.xml
0 → 100644
View file @
03b97d72
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
default
</string>
<string>
items
</string>
<string>
size
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_simulation_period
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_list_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
items
</string>
</key>
<value>
<list>
<tuple>
<string>
Current
</string>
<string>
current
</string>
</tuple>
<tuple>
<string>
Future
</string>
<string>
future
</string>
</tuple>
<tuple>
<string>
Available
</string>
<string>
available
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Simulation Period
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: [(context.Base_translateString(x), y) for x, y in field.get_orig_value(\'items\')]
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/tests/testTradeReports.py
View file @
03b97d72
...
...
@@ -43,7 +43,8 @@ class TestTradeReports(ERP5ReportTestCase):
def
getBusinessTemplateList
(
self
):
"""Returns list of BT to be installed."""
return
(
'erp5_core_proxy_field_legacy'
,
'erp5_base'
,
'erp5_pdm'
,
'erp5_trade'
,
'erp5_pdm'
,
)
'erp5_base'
,
'erp5_pdm'
,
'erp5_trade'
,
'erp5_simulation'
,
'erp5_simulation_test'
,
'erp5_configurator_standard_trade_template'
,
)
def
login
(
self
):
"""login with Manager roles."""
...
...
@@ -70,6 +71,7 @@ class TestTradeReports(ERP5ReportTestCase):
self
.
sale_order_module
=
self
.
portal
.
sale_order_module
self
.
product_module
=
self
.
portal
.
product_module
self
.
portal_categories
=
self
.
portal
.
portal_categories
self
.
validateRules
()
# Create site category
for
site_id
,
codification
in
(
...
...
@@ -195,6 +197,8 @@ class TestTradeReports(ERP5ReportTestCase):
list
(
self
.
inventory_module
.
objectIds
()))
self
.
sale_order_module
.
manage_delObjects
(
list
(
self
.
sale_order_module
.
objectIds
()))
self
.
portal
.
sale_packing_list_module
.
manage_delObjects
(
list
(
self
.
portal
.
sale_packing_list_module
.
objectIds
()))
self
.
tic
()
...
...
@@ -931,6 +935,30 @@ class TestTradeReports(ERP5ReportTestCase):
self
.
tic
()
def
_createConfirmedSalePackingListForStockReportTest
(
self
):
confirmed_sale_packing_list
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
,
title
=
'%s 1'
%
self
.
id
(),
destination_value
=
self
.
organisation_module
.
Organisation_1
,
destination_section_value
=
self
.
organisation_module
.
Organisation_1
,
source_value
=
self
.
organisation_module
.
Organisation_2
,
source_section_value
=
self
.
organisation_module
.
Organisation_2
,
start_date
=
DateTime
(
2006
,
2
,
2
),
specialise
=
'business_process_module/erp5_default_business_process'
,
description
=
'The description'
,
)
confirmed_sale_packing_list
.
newContent
(
portal_type
=
'Sale Packing List Line'
,
resource_value
=
self
.
portal
.
product_module
.
product_A
,
quantity
=
1
,
price
=
10
,
)
confirmed_sale_packing_list
.
confirm
()
self
.
tic
()
def
testStockReport_when_section_category_is_empty
(
self
):
self
.
_createInventoryForStockReportTest
()
request
=
self
.
portal
.
REQUEST
...
...
@@ -945,6 +973,29 @@ class TestTradeReports(ERP5ReportTestCase):
data_line_list
=
[
l
for
l
in
line_list
if
l
.
isDataLine
()]
self
.
assertEqual
(
1
,
len
(
data_line_list
))
def
testStockReport_future_simulation_period
(
self
):
self
.
_createConfirmedSalePackingListForStockReportTest
()
request
=
self
.
portal
.
REQUEST
request
.
form
[
'at_date'
]
=
DateTime
(
2007
,
3
,
3
)
request
.
form
[
'node_category'
]
=
'site/demo_site_A'
request
.
form
[
'simulation_period'
]
=
'future'
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
))
self
.
checkLineProperties
(
data_line_list
[
0
],
resource_title
=
'product_A'
,
resource_reference
=
'ref 2'
,
variation_category_item_list
=
[],
inventory
=
1
,
quantity_unit
=
'G'
)
def
testStockReport_old_date
(
self
):
"""
Old date
...
...
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