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
Yusei Tahara
erp5
Commits
25085d7b
Commit
25085d7b
authored
Feb 08, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
trade: extend "Lines Report" to allow filtering by use
See merge request
nexedi/erp5!1355
parents
5c3419ce
4723100a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
342 additions
and
6 deletions
+342
-6
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary.xml
...em/portal_skins/erp5_trade/Base_viewTradeFieldLibrary.xml
+1
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_dialog_mode_portal_type.xml
...Base_viewTradeFieldLibrary/my_dialog_mode_portal_type.xml
+4
-5
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_dialog_mode_use_list.xml
...de/Base_viewTradeFieldLibrary/my_dialog_mode_use_list.xml
+126
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
...al_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
+6
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.xml
...l_skins/erp5_trade/DeliveryModule_getDeliveryLineList.xml
+1
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineReportSectionList.py
..._trade/DeliveryModule_getDeliveryLineReportSectionList.py
+1
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_viewDeliveryLineReportDialog.xml
...rp5_trade/DeliveryModule_viewDeliveryLineReportDialog.xml
+1
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_viewDeliveryLineReportDialog/your_use.xml
.../DeliveryModule_viewDeliveryLineReportDialog/your_use.xml
+100
-0
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
...plateItem/portal_components/test.erp5.testTradeReports.py
+102
-0
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary.xml
View file @
25085d7b
...
...
@@ -305,6 +305,7 @@
<string>
my_report_mode_node_category
</string>
<string>
my_view_mode_ledger
</string>
<string>
my_report_mode_currency
</string>
<string>
my_dialog_mode_use_list
</string>
</list>
</value>
</item>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_dialog_mode_portal_type.xml
View file @
25085d7b
...
...
@@ -11,7 +11,6 @@
<value>
<list>
<string>
items
</string>
<string>
size
</string>
<string>
title
</string>
</list>
</value>
...
...
@@ -72,6 +71,10 @@
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -93,10 +96,6 @@
<list/>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
5
</int>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_dialog_mode_use_list.xml
0 → 100644
View file @
25085d7b
<?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>
items
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_dialog_mode_use_list
</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>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</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>
<item>
<key>
<string>
items
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
target
</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>
field_id
</string>
</key>
<value>
<string>
my_multi_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/>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Use
</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: getattr(here.portal_categories.use, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', base=True)
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.py
View file @
25085d7b
...
...
@@ -15,10 +15,16 @@ def getAccountTitle(relative_url):
account_title_cache
[
relative_url
]
=
title
return
title
isDisplayed
=
lambda
movement
:
True
if
use_list
:
def
isDisplayed
(
movement
):
# pylint:disable=function-redefined
return
any
(
movement
.
isMemberOf
(
use
)
for
use
in
use_list
)
for
delivery
in
portal
.
portal_catalog
(
uid
=
uid_list
or
-
1
):
delivery
=
delivery
.
getObject
()
for
movement
in
delivery
.
getMovementList
(
portal_type
=
portal_type
):
if
not
isDisplayed
(
movement
):
continue
line_list
.
append
(
Object
(
int_index
=
movement
.
getIntIndex
(),
title
=
movement
.
getTitle
(),
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineList.xml
View file @
25085d7b
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
uid_list, portal_type, **kw
</string>
</value>
<value>
<string>
uid_list, portal_type,
use_list,
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_getDeliveryLineReportSectionList.py
View file @
25085d7b
...
...
@@ -27,6 +27,7 @@ try:
ReportSection
(
form_id
=
'DeliveryModule_viewDeliveryLineList'
,
path
=
context
.
getPhysicalPath
(),
selection_params
=
dict
(
portal_type
=
request
[
'portal_type'
],
use_list
=
request
[
'use'
],
uid_list
=
uid_list
,
module_selection_name
=
module_selection_name
)))
return
report_section_list
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_viewDeliveryLineReportDialog.xml
View file @
25085d7b
...
...
@@ -105,6 +105,7 @@
<value>
<list>
<string>
your_portal_type
</string>
<string>
your_use
</string>
</list>
</value>
</item>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/DeliveryModule_viewDeliveryLineReportDialog/your_use.xml
0 → 100644
View file @
25085d7b
<?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>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_use
</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>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</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>
<item>
<key>
<string>
target
</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>
field_id
</string>
</key>
<value>
<string>
my_dialog_mode_use_list
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewTradeFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Movement Use
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
View file @
25085d7b
...
...
@@ -102,6 +102,16 @@ class TestTradeReports(ERP5ReportTestCase):
title
=
group_id
,
reference
=
group_id
,
id
=
group_id
)
# create use categories
for
use_id
in
(
'u1'
,
'u2'
):
if
not
self
.
portal_categories
[
'use'
].
has_key
(
use_id
):
self
.
portal_categories
.
use
.
newContent
(
portal_type
=
'Category'
,
title
=
use_id
,
reference
=
use_id
,
id
=
use_id
)
# currencies
if
not
self
.
portal
.
currency_module
.
has_key
(
'EUR'
):
self
.
portal
.
currency_module
.
newContent
(
...
...
@@ -1945,6 +1955,98 @@ class TestTradeReports(ERP5ReportTestCase):
# delivery_resource_text shows quantities and variations
delivery_resource_text
=
"ref 1: 1.0
\
n
ref 3 colour1: 3.0
\
n
ref 3 colour2: 2.0"
)
def
test_LinesReport
(
self
):
# Create sales orders
self
.
_makeOneSaleOrder
(
title
=
'SO 1'
,
destination_value
=
self
.
organisation_module
.
Organisation_1
,
destination_section_value
=
self
.
organisation_module
.
Organisation_1
,
destination_decision_value
=
self
.
organisation_module
.
Organisation_1
,
source_value
=
self
.
organisation_module
.
Organisation_2
,
source_section_value
=
self
.
organisation_module
.
Organisation_2
,
source_decision_value
=
self
.
organisation_module
.
Organisation_2
,
start_date
=
DateTime
(
2006
,
2
,
2
),
resource_dict
=
{
'product_module/product_A'
:{
"quantity"
:
11
,
"price"
:
3
},
'product_module/product_B'
:{
"quantity"
:
7
,
"price"
:
6
},},
)
self
.
_makeOneSaleOrder
(
title
=
'SO 2 (cancelled)'
,
destination_value
=
self
.
organisation_module
.
Organisation_1
,
destination_section_value
=
self
.
organisation_module
.
Organisation_1
,
destination_decision_value
=
self
.
organisation_module
.
Organisation_1
,
source_value
=
self
.
organisation_module
.
Organisation_2
,
source_section_value
=
self
.
organisation_module
.
Organisation_2
,
source_decision_value
=
self
.
organisation_module
.
Organisation_2
,
start_date
=
DateTime
(
2006
,
2
,
2
),
resource_dict
=
{
'product_module/product_A'
:{
"quantity"
:
11
,
"price"
:
3
},
'product_module/product_B'
:{
"quantity"
:
7
,
"price"
:
6
},},
cancel
=
True
,
)
# view the module first, it will set selection
self
.
portal
.
REQUEST
.
form
[
'simulation_state'
]
=
'draft'
view
=
self
.
portal
.
sale_order_module
.
view
()
self
.
assertFalse
(
'Site Error'
in
view
)
self
.
portal
.
REQUEST
.
form
[
'portal_type'
]
=
[
'Sale Order Line'
]
self
.
portal
.
REQUEST
.
form
[
'use'
]
=
[]
report_section
,
=
self
.
getReportSectionList
(
self
.
sale_order_module
,
'DeliveryModule_viewDeliveryLineReport'
)
line_list
=
sorted
(
(
l
for
l
in
self
.
getListBoxLineList
(
report_section
)
if
l
.
isDataLine
()),
key
=
lambda
x
:
x
.
getColumnProperty
(
'quantity'
))
self
.
assertEqual
(
len
(
line_list
),
2
)
self
.
checkLineProperties
(
line_list
[
0
],
start_date
=
DateTime
(
2006
,
2
,
2
),
quantity
=
7
,
price
=
6
,
)
self
.
checkLineProperties
(
line_list
[
1
],
start_date
=
DateTime
(
2006
,
2
,
2
),
quantity
=
11
,
price
=
3
,
)
def
test_LinesReport_use
(
self
):
sale_order
=
self
.
sale_order_module
.
newContent
(
portal_type
=
"Sale Order"
)
sale_order
.
newContent
(
portal_type
=
"Sale Order Line"
,
resource_value
=
self
.
portal
.
product_module
.
product_A
,
use_value
=
self
.
portal
.
portal_categories
.
use
.
u1
,
quantity
=
2
,
price
=
3
,
)
sale_order
.
newContent
(
portal_type
=
"Sale Order Line"
,
resource_value
=
self
.
portal
.
product_module
.
product_A
,
use_value
=
self
.
portal
.
portal_categories
.
use
.
u2
,
quantity
=
3
,
price
=
4
,
)
self
.
tic
()
# view the module first, it will set selection
view
=
self
.
portal
.
sale_order_module
.
view
()
self
.
assertFalse
(
'Site Error'
in
view
)
self
.
portal
.
REQUEST
.
form
[
'portal_type'
]
=
[
'Sale Order Line'
]
self
.
portal
.
REQUEST
.
form
[
'use'
]
=
[
'use/u1'
]
report_section
,
=
self
.
getReportSectionList
(
self
.
sale_order_module
,
'DeliveryModule_viewDeliveryLineReport'
)
line_list
=
[
l
for
l
in
self
.
getListBoxLineList
(
report_section
)
if
l
.
isDataLine
()]
self
.
assertEqual
(
len
(
line_list
),
1
)
self
.
checkLineProperties
(
line_list
[
0
],
quantity
=
2
,
price
=
3
,
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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