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
6cbb159d
Commit
6cbb159d
authored
May 16, 2022
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
erp5_trade: add product line selection in stock report
See merge request
nexedi/erp5!1628
parents
7a7b4a45
e1360ac0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
304 additions
and
1 deletion
+304
-1
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
...teItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
+3
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
...eItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
+1
-1
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/your_product_line.xml
...p5_trade/Base_viewStockReportBySite/your_product_line.xml
+134
-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_product_line.xml
...de/Base_viewStockReportBySiteDialog/your_product_line.xml
+110
-0
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
...plateItem/portal_components/test.erp5.testTradeReports.py
+54
-0
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.py
View file @
6cbb159d
...
...
@@ -8,6 +8,9 @@ inventory_list_method_dict = {
if
section_category
:
kw
[
'section_category'
]
=
section_category
if
product_line
:
kw
[
'resource_category'
]
=
product_line
for
brain
in
getattr
(
context
.
portal_simulation
,
inventory_list_method_dict
[
simulation_period
])(
node_category
=
node_category
,
group_by_resource
=
True
,
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_getBySiteStockList.xml
View file @
6cbb159d
...
...
@@ -50,7 +50,7 @@
</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, simulation_period="current", **kw
</string>
</value>
<value>
<string>
at_date=None, node_category=None, section_category=None, p
roduct_line=None, p
ositive_stock=None, negative_stock=None, zero_stock=None, simulation_period="current", **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite.xml
View file @
6cbb159d
...
...
@@ -104,6 +104,7 @@
<string>
your_section_category
</string>
<string>
your_at_date
</string>
<string>
your_simulation_period
</string>
<string>
your_product_line
</string>
<string>
your_currency
</string>
</list>
</value>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySite/your_product_line.xml
0 → 100644
View file @
6cbb159d
<?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>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_product_line
</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>
</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/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Product Line
</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/product_line | nothing
</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: getattr(here.portal_categories.product_line, 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/Base_viewStockReportBySiteDialog.xml
View file @
6cbb159d
...
...
@@ -111,6 +111,7 @@
<string>
your_negative_stock
</string>
<string>
your_zero_stock
</string>
<string>
your_item_stock
</string>
<string>
your_product_line
</string>
<string>
your_inventory_valuation_method
</string>
</list>
</value>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Base_viewStockReportBySiteDialog/your_product_line.xml
0 → 100644
View file @
6cbb159d
<?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>
your_product_line
</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>
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>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<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/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Product Line
</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.product_line, 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/TestTemplateItem/portal_components/test.erp5.testTradeReports.py
View file @
6cbb159d
...
...
@@ -120,6 +120,16 @@ class TestTradeReports(ERP5ReportTestCase):
base_unit_quantity
=
0.01
,
).
validate
()
# product line
for
product_line
in
(
'product_line_a'
,
'product_line_b'
):
if
not
self
.
portal_categories
.
product_line
.
has_key
(
product_line
):
self
.
portal_categories
.
product_line
.
newContent
(
portal_type
=
'Category'
,
title
=
product_line
,
reference
=
product_line
,
id
=
product_line
)
# create organisations (with no organisation member of g3)
if
not
self
.
organisation_module
.
has_key
(
'Organisation_1'
):
self
.
portal
.
organisation_module
.
newContent
(
...
...
@@ -185,6 +195,7 @@ class TestTradeReports(ERP5ReportTestCase):
id
=
'product_A'
,
title
=
'product_A'
,
reference
=
'ref 2'
,
product_line
=
'product_line/product_line_a'
,
quantity_unit_list
=
(
'mass/g'
,
'mass/kg'
),
default_purchase_supply_line_base_price
=
3
,
default_internal_supply_line_base_price
=
5
,
...
...
@@ -1572,6 +1583,49 @@ class TestTradeReports(ERP5ReportTestCase):
self
.
assertEqual
(
0
,
len
(
data_line_list
))
def
testStockReport_product_line
(
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
[
'product_line'
]
=
'product_line/product_line_b'
request
.
form
[
'simulation_period'
]
=
'future'
request
.
form
[
'inventory_valuation_method'
]
=
'default_purchase_price'
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
(
0
,
len
(
data_line_list
))
# change product line parameter
request
.
form
[
'product_line'
]
=
'product_line/product_line_a'
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
))
data_line
=
data_line_list
[
0
]
self
.
assertEqual
(
data_line
.
column_id_list
,
[
'resource_title'
,
'resource_reference'
,
'variation_category_item_list'
,
'inventory'
,
'quantity_unit'
,
'total_price'
])
self
.
checkLineProperties
(
data_line_list
[
0
],
resource_title
=
'product_A'
,
resource_reference
=
'ref 2'
,
variation_category_item_list
=
[],
inventory
=
1
,
quantity_unit
=
'G'
,
total_price
=
3
,
)
# listbox_total_price is an editable field using this for precision
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
get
(
'precision'
),
2
)
def
testStockReport_valuation_method_default_default_purchase_price
(
self
):
self
.
_createConfirmedSalePackingListForStockReportTest
()
request
=
self
.
portal
.
REQUEST
...
...
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