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
7562118d
Commit
7562118d
authored
Dec 18, 2018
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testInventoryReportModule: add more packing list test
parent
4486252e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
228 additions
and
119 deletions
+228
-119
product/ERP5/tests/testInventoryReportModule.py
product/ERP5/tests/testInventoryReportModule.py
+228
-119
No files found.
product/ERP5/tests/testInventoryReportModule.py
View file @
7562118d
...
@@ -43,7 +43,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -43,7 +43,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
"""
"""
"""
"""
return
super
(
TestInventoryReportModule
,
self
).
getBusinessTemplateList
()
+
(
'erp5_accounting'
,)
return
super
(
TestInventoryReportModule
,
self
).
getBusinessTemplateList
()
+
(
'erp5_accounting'
,
'erp5_mrp'
,
)
def
getTitle
(
self
):
def
getTitle
(
self
):
...
@@ -169,9 +169,27 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -169,9 +169,27 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
organisation_euro
=
organisation_euro
organisation_euro
=
organisation_euro
)
)
def
stepCreateTwoWarehouse
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreateOrganisation
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
**
kw
)
warehouseA
=
sequence
.
get
(
'organisation'
)
self
.
stepCreateOrganisation
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
**
kw
)
warehouseB
=
sequence
.
get
(
'organisation'
)
sequence
.
edit
(
warehouseA
=
warehouseA
,
warehouseB
=
warehouseB
)
def
stepCreateSalesPackingListRMBToEURO
(
self
,
sequence
=
None
,
def
stepCreateSalesPackingListRMBToEURO
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreate
Sales
PackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_rmb'
),
source
=
sequence
.
get
(
'organisation_rmb'
),
...
@@ -180,11 +198,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -180,11 +198,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
price
=
50
,
price
=
50
,
create_line
=
True
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/11 00:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 00:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'rmb'
))
price_currency
=
sequence
.
get
(
'rmb'
),
packing_list_type
=
'Sale Packing List'
)
def
stepCreateSalesPackingListEUROToUSD
(
self
,
sequence
=
None
,
def
stepCreateSalesPackingListEUROToUSD
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreate
Sales
PackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'organisation_euro'
),
...
@@ -193,13 +212,14 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -193,13 +212,14 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
price
=
50
,
price
=
50
,
create_line
=
True
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/11 05:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 05:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
))
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Sale Packing List'
)
def
stepCreatePurchasePackingListFromRMBToEURO
(
self
,
sequence
=
None
,
def
stepCreatePurchasePackingListFromRMBToEURO
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreateP
urchaseP
ackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_rmb'
),
source
=
sequence
.
get
(
'organisation_rmb'
),
...
@@ -208,11 +228,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -208,11 +228,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
price
=
80
,
price
=
80
,
create_line
=
True
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/11 02:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 02:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'rmb'
))
price_currency
=
sequence
.
get
(
'rmb'
),
packing_list_type
=
'Purchase Packing List'
)
def
stepCreatePurchasePackingListFromEUROToUSD
(
self
,
sequence
=
None
,
def
stepCreatePurchasePackingListFromEUROToUSD
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreateP
urchaseP
ackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'organisation_euro'
),
...
@@ -221,142 +242,134 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -221,142 +242,134 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
price
=
123
,
price
=
123
,
create_line
=
True
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/11 03:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 03:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
))
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Purchase Packing List'
)
def
stepCreateProductionPackingListFromEUROWarehouseAToEuroWarehouseB
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
source_section
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'warehouseA'
),
destination_section
=
sequence
.
get
(
'organisation_euro'
),
destination
=
sequence
.
get
(
'warehouseB'
),
quantity
=
50
,
price
=
50
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/12 00:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Production Packing List'
)
def
stepCreateInternalPackingListFromEUROWarehouseEuroToEuroWarehouseB
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
source_section
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'organisation_euro'
),
destination_section
=
sequence
.
get
(
'organisation_euro'
),
destination
=
sequence
.
get
(
'warehouseB'
),
quantity
=
14
,
price
=
16
,
create_line
=
True
,
at_date
=
DateTime
(
'2018/06/13 00:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Internal Packing List'
)
def
stepCreateSalesPackingListEUROToRMB
(
self
,
sequence
=
None
,
def
stepCreateSalesPackingListEUROToRMB
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreate
Sales
PackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'organisation_euro'
),
destination
=
sequence
.
get
(
'organisation_rmb'
),
destination
=
sequence
.
get
(
'organisation_rmb'
),
create_line
=
False
,
create_line
=
False
,
at_date
=
DateTime
(
'2018/06/11 04:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 04:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
))
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Sale Packing List'
)
def
stepCreateSalesPackingListRMBToUSD
(
self
,
sequence
=
None
,
def
stepCreateSalesPackingListRMBToUSD
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreate
Sales
PackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_rmb'
),
source
=
sequence
.
get
(
'organisation_rmb'
),
destination
=
sequence
.
get
(
'organisation_dollar'
),
destination
=
sequence
.
get
(
'organisation_dollar'
),
create_line
=
False
,
create_line
=
False
,
at_date
=
DateTime
(
'2018/06/11 05:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/06/11 05:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'rmb'
))
price_currency
=
sequence
.
get
(
'rmb'
),
packing_list_type
=
'Sale Packing List'
)
def
stepCreatePurchasePackingListFromUSDToRMB
(
self
,
sequence
=
None
,
def
stepCreatePurchasePackingListFromUSDToRMB
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
stepCreateP
urchaseP
ackingList
(
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence
=
sequence
,
sequence_list
=
sequence_list
,
sequence_list
=
sequence_list
,
source
=
sequence
.
get
(
'organisation_dollar'
),
source
=
sequence
.
get
(
'organisation_dollar'
),
destination
=
sequence
.
get
(
'organisation_rmb'
),
destination
=
sequence
.
get
(
'organisation_rmb'
),
create_line
=
False
,
create_line
=
False
,
at_date
=
DateTime
(
'2018/07/11 03:00:00 GMT+0'
),
at_date
=
DateTime
(
'2018/07/11 03:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'dollar'
))
price_currency
=
sequence
.
get
(
'dollar'
),
packing_list_type
=
'Purchase Packing List'
)
def
stepCreateVariatedPurchasePackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreateInternalPackingListFromEUROWarehouseEuroToEuroWarehouseB1
(
self
,
sequence
=
None
,
resource_list
=
sequence
.
get
(
'resource_list'
)
sequence_list
=
None
,
**
kw
):
packing_list
=
sequence
.
get
(
'packing_list'
)
self
.
stepCreatePackingList
(
#create with last resource
sequence
=
sequence
,
packing_list_line
=
packing_list
.
newContent
(
sequence_list
=
sequence_list
,
portal_type
=
'Purchase Packing List Line'
)
source_section
=
sequence
.
get
(
'organisation_euro'
),
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
])
source
=
sequence
.
get
(
'organisation_euro'
),
destination_section
=
sequence
.
get
(
'organisation_euro'
),
resource_vcl
=
list
(
resource_list
[
-
1
].
getVariationCategoryList
(
destination
=
sequence
.
get
(
'warehouseB'
),
omit_individual_variation
=
1
,
omit_optional_variation
=
1
))
create_line
=
False
,
resource_vcl
.
sort
()
at_date
=
DateTime
(
'2018/08/01 04:00:00 GMT+0'
),
self
.
assertEqual
(
len
(
resource_vcl
),
2
)
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_line
.
setVariationCategoryList
(
resource_vcl
)
packing_list_type
=
'Internal Packing List'
)
cell_key_list
=
list
(
packing_list_line
.
getCellKeyList
(
base_id
=
'movement'
))
price
=
32
quantity
=
134
for
cell_key
in
cell_key_list
:
cell
=
packing_list_line
.
newCell
(
base_id
=
'movement'
,
portal_type
=
'Purchase Packing List Cell'
,
*
cell_key
)
cell
.
edit
(
mapped_value_property_list
=
[
'price'
,
'quantity'
],
price
=
price
,
quantity
=
quantity
,
predicate_category_list
=
cell_key
,
variation_category_list
=
cell_key
,)
price
+=
1
quantity
+=
1
sequence
.
edit
(
packing_list
=
packing_list
)
def
stepCreateProductionPackingListFromEUROWarehouseAToEuroWarehouseB1
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreatePackingList
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
source_section
=
sequence
.
get
(
'organisation_euro'
),
source
=
sequence
.
get
(
'warehouseA'
),
destination_section
=
sequence
.
get
(
'organisation_euro'
),
destination
=
sequence
.
get
(
'warehouseB'
),
create_line
=
False
,
at_date
=
DateTime
(
'2018/08/02 04:00:00 GMT+0'
),
price_currency
=
sequence
.
get
(
'euro'
),
packing_list_type
=
'Production Packing List'
)
def
stepCreatePurchasePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreatePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
organisation_rmb
=
sequence
.
get
(
'organisation_rmb'
)
organisation_dollar
=
sequence
.
get
(
'organisation_dollar'
)
organisation_euro
=
sequence
.
get
(
'organisation_euro'
)
resource_list
=
sequence
.
get
(
'resource_list'
)
resource_list
=
sequence
.
get
(
'resource_list'
)
quantity
=
kw
.
get
(
'quantity'
,
100
)
quantity
=
kw
.
get
(
'quantity'
,
100
)
price
=
kw
.
get
(
'price'
,
100
)
price
=
kw
.
get
(
'price'
,
100
)
price_currency
=
kw
.
get
(
'price_currency'
)
price_currency
=
kw
.
get
(
'price_currency'
)
create_line
=
kw
.
get
(
'create_line'
,
False
)
create_line
=
kw
.
get
(
'create_line'
,
False
)
at_date
=
kw
.
get
(
'at_date'
,
DateTime
())
at_date
=
kw
.
get
(
'at_date'
,
DateTime
())
packing_list_type
=
kw
.
get
(
'packing_list_type'
)
source
=
kw
.
get
(
'source'
)
source
=
kw
.
get
(
'source'
)
destination
=
kw
.
get
(
'destination'
)
destination
=
kw
.
get
(
'destination'
)
packing_list_module
=
self
.
getPortal
().
getDefaultModule
(
source_section
=
kw
.
get
(
'source_section'
,
source
)
portal_type
=
'Purchase Packing List'
)
destination_section
=
kw
.
get
(
'destination_section'
,
destination
)
packing_list
=
packing_list_module
.
newContent
(
portal_type
=
'Purchase Packing List'
)
start_date
=
stop_date
=
at_date
packing_list
.
edit
(
specialise
=
self
.
business_process
,
source_section_value
=
source
,
source_value
=
source
,
destination_section_value
=
destination
,
destination_value
=
destination
,
start_date
=
start_date
,
stop_date
=
stop_date
,
price_currency
=
price_currency
.
getRelativeUrl
()
)
#create with last resource
if
create_line
:
packing_list_line
=
packing_list
.
newContent
(
portal_type
=
'Purchase Packing List Line'
)
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
],
quantity
=
quantity
,
price
=
price
)
sequence
.
edit
(
packing_list
=
packing_list
)
def
stepCreateSalesPackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
organisation_rmb
=
sequence
.
get
(
'organisation_rmb'
)
organisation_dollar
=
sequence
.
get
(
'organisation_dollar'
)
organisation_euro
=
sequence
.
get
(
'organisation_euro'
)
resource_list
=
sequence
.
get
(
'resource_list'
)
quantity
=
kw
.
get
(
'quantity'
,
100
)
price
=
kw
.
get
(
'price'
,
100
)
price_currency
=
kw
.
get
(
'price_currency'
)
create_line
=
kw
.
get
(
'create_line'
,
False
)
at_date
=
kw
.
get
(
'at_date'
,
DateTime
())
source
=
kw
.
get
(
'source'
)
destination
=
kw
.
get
(
'destination'
)
packing_list_module
=
self
.
getPortal
().
getDefaultModule
(
packing_list_module
=
self
.
getPortal
().
getDefaultModule
(
portal_type
=
'Sale Packing List'
)
portal_type
=
packing_list_type
)
packing_list
=
packing_list_module
.
newContent
(
packing_list
=
packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
)
portal_type
=
packing_list_type
)
start_date
=
stop_date
=
at_date
start_date
=
stop_date
=
at_date
packing_list
.
edit
(
packing_list
.
edit
(
specialise
=
self
.
business_process
,
specialise
=
self
.
business_process
,
source_section_value
=
source
,
source_section_value
=
source
_section
,
source_value
=
source
,
source_value
=
source
,
destination_section_value
=
destination
,
destination_section_value
=
destination
_section
,
destination_value
=
destination
,
destination_value
=
destination
,
start_date
=
start_date
,
start_date
=
start_date
,
stop_date
=
stop_date
,
stop_date
=
stop_date
,
...
@@ -365,7 +378,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -365,7 +378,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
#create with last resource
#create with last resource
if
create_line
:
if
create_line
:
packing_list_line
=
packing_list
.
newContent
(
packing_list_line
=
packing_list
.
newContent
(
portal_type
=
'Sale Packing List
Line'
)
portal_type
=
packing_list_type
+
'
Line'
)
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
],
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
],
quantity
=
quantity
,
quantity
=
quantity
,
price
=
price
price
=
price
...
@@ -374,11 +387,38 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -374,11 +387,38 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
def
stepCreateVariatedSalesPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreateVariatedSalesPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreateVariatedPackingListLine
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
packing_list_type
=
'Sale Packing List'
)
def
stepCreateVariatedPurchasePackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreateVariatedPackingListLine
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
packing_list_type
=
'Purchase Packing List'
,
quantity
=
134
,
price
=
32
)
def
stepCreateVariatedInternalPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreateVariatedPackingListLine
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
packing_list_type
=
'Internal Packing List'
)
def
stepCreateVariatedProductionPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
stepCreateVariatedPackingListLine
(
sequence
=
sequence
,
sequence_list
=
sequence_list
,
packing_list_type
=
'Production Packing List'
)
def
stepCreateVariatedPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
resource_list
=
sequence
.
get
(
'resource_list'
)
resource_list
=
sequence
.
get
(
'resource_list'
)
packing_list
=
sequence
.
get
(
'packing_list'
)
packing_list
=
sequence
.
get
(
'packing_list'
)
#create with last resource
#create with last resource
packing_list_type
=
kw
.
get
(
'packing_list_type'
)
packing_list_line
=
packing_list
.
newContent
(
packing_list_line
=
packing_list
.
newContent
(
portal_type
=
'Sale Packing List
Line'
)
portal_type
=
packing_list_type
+
'
Line'
)
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
])
packing_list_line
.
edit
(
resource_value
=
resource_list
[
-
1
])
resource_vcl
=
list
(
resource_list
[
-
1
].
getVariationCategoryList
(
resource_vcl
=
list
(
resource_list
[
-
1
].
getVariationCategoryList
(
...
@@ -387,11 +427,11 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -387,11 +427,11 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
self
.
assertEqual
(
len
(
resource_vcl
),
2
)
self
.
assertEqual
(
len
(
resource_vcl
),
2
)
packing_list_line
.
setVariationCategoryList
(
resource_vcl
)
packing_list_line
.
setVariationCategoryList
(
resource_vcl
)
cell_key_list
=
list
(
packing_list_line
.
getCellKeyList
(
base_id
=
'movement'
))
cell_key_list
=
list
(
packing_list_line
.
getCellKeyList
(
base_id
=
'movement'
))
price
=
50
price
=
kw
.
get
(
'price'
,
50
)
quantity
=
200
quantity
=
kw
.
get
(
'quantity'
,
200
)
for
cell_key
in
cell_key_list
:
for
cell_key
in
cell_key_list
:
cell
=
packing_list_line
.
newCell
(
base_id
=
'movement'
,
cell
=
packing_list_line
.
newCell
(
base_id
=
'movement'
,
portal_type
=
'Sale Packing List
Cell'
,
portal_type
=
packing_list_type
+
'
Cell'
,
*
cell_key
)
*
cell_key
)
cell
.
edit
(
mapped_value_property_list
=
[
'price'
,
'quantity'
],
cell
.
edit
(
mapped_value_property_list
=
[
'price'
,
'quantity'
],
price
=
price
,
quantity
=
quantity
,
price
=
price
,
quantity
=
quantity
,
...
@@ -448,8 +488,8 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -448,8 +488,8 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
.
edit
(
inventory_report
.
edit
(
destination_value
=
sequence
.
get
(
'organisation_euro'
),
destination_section_value
=
sequence
.
get
(
'organisation_euro'
),
destination_section_value
=
sequence
.
get
(
'organisation_euro'
),
destination_value
=
sequence
.
get
(
'warehouseB'
),
valuation_method
=
'Fifo'
valuation_method
=
'Fifo'
)
)
self
.
tic
()
self
.
tic
()
...
@@ -458,12 +498,37 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -458,12 +498,37 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
3
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
3
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
50
+
14
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
50
*
50
+
14
*
16
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
200
*
2
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
200
*
50
*
2
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
201
*
2
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
201
*
51
*
2
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
.
edit
(
destination_value
=
sequence
.
get
(
'organisation_euro'
),
destination_section_value
=
sequence
.
get
(
'organisation_euro'
),
valuation_method
=
'Fifo'
)
self
.
tic
()
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
self
.
tic
()
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
5
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
1
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
45
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
-
200
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
45
*
80
*
0.13
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_quantity
,
-
200
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
4
].
total_quantity
,
45
-
14
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
4
].
total_asset_price
,
(
45
-
14
)
*
80
*
0.13
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
...
@@ -476,14 +541,18 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -476,14 +541,18 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
self
.
tic
()
self
.
tic
()
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
3
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
5
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
1
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
45
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
-
200
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
45
*
50
*
0.13
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_quantity
,
-
200
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
4
].
total_quantity
,
45
-
14
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
4
].
total_asset_price
,
(
45
-
14
)
*
50
*
0.13
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
.
edit
(
inventory_report
.
edit
(
...
@@ -495,15 +564,19 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -495,15 +564,19 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
self
.
tic
()
self
.
tic
()
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
3
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
5
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
1
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
45
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
-
200
)
#45*(80*80 + 50*50)/(80 + 50)*0.13,
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
0
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
400.5
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_quantity
,
-
200
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
4
].
total_quantity
,
45
-
14
)
#(45-14)*(80*80 + 50*50)/(80 + 50)*0.13
self
.
assertAlmostEqual
(
inventory_report_line_list
[
4
].
total_asset_price
,
275.9
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
...
@@ -516,15 +589,19 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -516,15 +589,19 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
inventory_report
.
InventoryReport_calculateProductStock
(
batch_mode
=
True
)
self
.
tic
()
self
.
tic
()
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
inventory_report_line_list
=
inventory_report
.
contentValues
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
3
)
self
.
assertEqual
(
len
(
inventory_report_line_list
),
5
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
inventory_report_line_list
.
sort
(
key
=
lambda
x
:
x
.
total_quantity
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_quantity
,
-
201
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
0
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_quantity
,
-
20
1
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
1
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
45
)
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_quantity
,
-
200
)
#45*(80*80 + 50*50)/(80 + 50)*0.13
self
.
assertEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
0
)
self
.
assertAlmostEqual
(
inventory_report_line_list
[
2
].
total_asset_price
,
400.5
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_quantity
,
-
200
)
self
.
assertEqual
(
inventory_report_line_list
[
3
].
total_asset_price
,
0
)
self
.
assertEqual
(
inventory_report_line_list
[
4
].
total_quantity
,
45
-
14
)
#(45-14)*(80*80 + 50*50)/(80 + 50)*0.13
self
.
assertAlmostEqual
(
inventory_report_line_list
[
4
].
total_asset_price
,
275.9
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
.
edit
(
inventory_report
.
edit
(
...
@@ -693,6 +770,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -693,6 +770,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
2018/06/11 05:00:00 GMT+0
2018/06/11 05:00:00 GMT+0
organisation_euro ---> organisation_dollar sale packing list, quantity: 50, price: 50 euro, product: notvariatedresource
organisation_euro ---> organisation_dollar sale packing list, quantity: 50, price: 50 euro, product: notvariatedresource
2018/06/12 00:00:00 GMT+0
organisation_euro warehouseA ---> organisation_euro warehouseB production packing list, quantity: 50, price: 50 euro, product: notvariatedresource
2018/06/13 00:00:00 GMT+0
organisation_euro organisation_euro ---> organisation_euro warehouseB internal packing list, quantity: 14, price: 16 euro, product: notvariatedresource
2018/06/11 04:00:00 GMT+0
2018/06/11 04:00:00 GMT+0
organisation_euro ---> organisation_rmb sale packing list, quantity: 200, price: 50 euro, product: variatedresourceA Child/32
organisation_euro ---> organisation_rmb sale packing list, quantity: 200, price: 50 euro, product: variatedresourceA Child/32
organisation_euro ---> organisation_rmb sale packing list, quantity: 201, price: 51 euro, product: variatedresourceA Child/34
organisation_euro ---> organisation_rmb sale packing list, quantity: 201, price: 51 euro, product: variatedresourceA Child/34
...
@@ -704,6 +787,17 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -704,6 +787,17 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
2018/07/11 03:00:00 GMT+0
2018/07/11 03:00:00 GMT+0
organisation_dollar ---> organisation_rmb purchase packing list, quantity: 134, price: 32 dollar, product: variatedresourceB child/32
organisation_dollar ---> organisation_rmb purchase packing list, quantity: 134, price: 32 dollar, product: variatedresourceB child/32
organisation_dollar ---> organisation_rmb purchase packing list, quantity: 135, price: 33 dollar, product: variatedresourceB child/34
organisation_dollar ---> organisation_rmb purchase packing list, quantity: 135, price: 33 dollar, product: variatedresourceB child/34
2018/08/01 04:00:00 GMT+0
organisation_euro organisation_euro ---> organisation_euro warehouseB internal packing list, quantity: 200, price: 50 euro, product: variatedresourceA Child/32
organisation_euro organisation_euro ---> organisation_euro warehouseB internal packing list, quantity: 201, price: 51 euro, product: variatedresourceA Child/32
2018/08/02 04:00:00 GMT+0
organisation_euro warehouseA ---> organisation_euro warehouseB production packing list, quantity: 200, price: 50 euro, product: variatedresourceA Child/32
organisation_euro warehouseA ---> organisation_euro warehouseB production packing list, quantity: 201, price: 51 euro, product: variatedresourceA Child/32
"""
"""
if
not
run
:
return
if
not
run
:
return
sequence_list
=
SequenceList
()
sequence_list
=
SequenceList
()
...
@@ -711,6 +805,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -711,6 +805,7 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
stepCreateThreeCurrencys
\
stepCreateThreeCurrencys
\
stepSetResourceUnit
\
stepSetResourceUnit
\
stepCreateThreeOrganisations
\
stepCreateThreeOrganisations
\
stepCreateTwoWarehouse
\
stepTic
\
stepTic
\
stepCreateSalesPackingListRMBToEURO
\
stepCreateSalesPackingListRMBToEURO
\
stepDeliverPackingList
\
stepDeliverPackingList
\
...
@@ -724,6 +819,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -724,6 +819,12 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
stepCreatePurchasePackingListFromEUROToUSD
\
stepCreatePurchasePackingListFromEUROToUSD
\
stepDeliverPackingList
\
stepDeliverPackingList
\
stepTic
\
stepTic
\
stepCreateProductionPackingListFromEUROWarehouseAToEuroWarehouseB
\
stepDeliverPackingList
\
stepTic
\
stepCreateInternalPackingListFromEUROWarehouseEuroToEuroWarehouseB
\
stepDeliverPackingList
\
stepTic
\
stepCreateVariatedResource
\
stepCreateVariatedResource
\
stepSetResourceUnit
\
stepSetResourceUnit
\
stepTic
\
stepTic
\
...
@@ -742,6 +843,14 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -742,6 +843,14 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
stepCreateVariatedPurchasePackingListLine
\
stepCreateVariatedPurchasePackingListLine
\
stepDeliverPackingList
\
stepDeliverPackingList
\
stepTic
\
stepTic
\
stepCreateInternalPackingListFromEUROWarehouseEuroToEuroWarehouseB1
\
stepCreateVariatedInternalPackingListLine
\
stepDeliverPackingList
\
stepTic
\
stepCreateProductionPackingListFromEUROWarehouseAToEuroWarehouseB1
\
stepCreateVariatedProductionPackingListLine
\
stepDeliverPackingList
\
stepTic
\
stepTestCalculateProduct
\
stepTestCalculateProduct
\
'
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
...
...
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