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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
09252af2
Commit
09252af2
authored
Nov 20, 2024
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: support date on line
idea is do a loop for different stop date
parent
0f780638
Pipeline
#38199
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
176 additions
and
158 deletions
+176
-158
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Inventory.py
...TemplateItem/portal_components/document.erp5.Inventory.py
+176
-158
No files found.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Inventory.py
View file @
09252af2
...
@@ -143,12 +143,11 @@ class Inventory(Delivery):
...
@@ -143,12 +143,11 @@ class Inventory(Delivery):
if
method
is
not
None
:
if
method
is
not
None
:
default_inventory_calculation_list
=
method
()
default_inventory_calculation_list
=
method
()
if
temp_constructor
is
None
:
if
temp_constructor
is
None
:
temp_constructor
=
lambda
self
,
id
,
*
args
,
**
kw
:
self
.
newContent
(
temp_constructor
=
lambda
self
,
id
,
*
args
,
**
kw
:
self
.
newContent
(
temp_object
=
True
,
portal_type
=
'Movement'
,
temp_object
=
True
,
portal_type
=
'Movement'
,
id
=
id
,
*
args
,
**
kw
)
id
=
id
,
*
args
,
**
kw
)
stop_date
=
self
.
getStopDate
()
#
stop_date = self.getStopDate()
stock_object_list
=
[]
stock_object_list
=
[]
stock_append
=
stock_object_list
.
append
stock_append
=
stock_object_list
.
append
...
@@ -158,6 +157,16 @@ class Inventory(Delivery):
...
@@ -158,6 +157,16 @@ class Inventory(Delivery):
to_delete_list_append
=
to_delete_list
.
append
to_delete_list_append
=
to_delete_list
.
append
for
inventory_calculation_dict
in
default_inventory_calculation_list
:
for
inventory_calculation_dict
in
default_inventory_calculation_list
:
stop_date_list
=
[]
list_method
=
inventory_calculation_dict
[
'list_method'
]
method
=
getattr
(
self
,
list_method
)
for
movement
in
method
():
if
(
movement
.
getResourceValue
()
is
not
None
)
and
(
movement
.
getInventoriatedQuantity
()
not
in
(
None
,
''
)):
stop_date
=
movement
.
getStopDate
()
if
stop_date
not
in
stop_date_list
:
stop_date_list
.
append
(
stop_date
)
stop_date_list
=
sorted
(
stop_date_list
)
for
stop_date
in
stop_date_list
:
# build a dict containing all inventory for this node
# build a dict containing all inventory for this node
# group by resource/variation and then subvariation
# group by resource/variation and then subvariation
...
@@ -209,7 +218,8 @@ class Inventory(Delivery):
...
@@ -209,7 +218,8 @@ class Inventory(Delivery):
for
movement
in
method
():
for
movement
in
method
():
if
movement
.
getResourceValue
()
is
not
None
and
\
if
movement
.
getResourceValue
()
is
not
None
and
\
movement
.
getInventoriatedQuantity
()
not
in
(
None
,
''
):
movement
.
getInventoriatedQuantity
()
not
in
(
None
,
''
):
if
movement
.
getStopDate
()
!=
stop_date
:
continue
movement_quantity
=
movement
.
getInventoriatedQuantity
()
movement_quantity
=
movement
.
getInventoriatedQuantity
()
# construct key to retrieve inventory into dict
# construct key to retrieve inventory into dict
getter_list
=
[
x
[
'getter'
]
for
x
in
inventory_calculation_dict
[
'first_level'
]]
getter_list
=
[
x
[
'getter'
]
for
x
in
inventory_calculation_dict
[
'first_level'
]]
...
@@ -249,6 +259,7 @@ class Inventory(Delivery):
...
@@ -249,6 +259,7 @@ class Inventory(Delivery):
# Create tmp movement
# Create tmp movement
kwd
=
{
'uid'
:
movement
.
getUid
(),
kwd
=
{
'uid'
:
movement
.
getUid
(),
'start_date'
:
stop_date
,
'start_date'
:
stop_date
,
'stop_date'
:
stop_date
,
'order_id'
:
getOrderIdCounter
(),
'order_id'
:
getOrderIdCounter
(),
'mirror_order_id'
:
getOrderIdCounter
()
'mirror_order_id'
:
getOrderIdCounter
()
}
}
...
@@ -300,6 +311,7 @@ class Inventory(Delivery):
...
@@ -300,6 +311,7 @@ class Inventory(Delivery):
kwd
=
{
'uid'
:
inventory_uid
,
kwd
=
{
'uid'
:
inventory_uid
,
'start_date'
:
stop_date
,
'start_date'
:
stop_date
,
'stop_date'
:
stop_date
,
'order_id'
:
getOrderIdCounter
(),
'order_id'
:
getOrderIdCounter
(),
'mirror_order_id'
:
getOrderIdCounter
()
'mirror_order_id'
:
getOrderIdCounter
()
}
}
...
@@ -358,3 +370,9 @@ class Inventory(Delivery):
...
@@ -358,3 +370,9 @@ class Inventory(Delivery):
portal
.
portal_catalog
.
catalogObjectList
(
portal
.
portal_catalog
.
catalogObjectList
(
stock_object_list
[:],
method_id_list
=
(
'z_catalog_stock_list_without_delete_for_inventory_virtual_movement'
,
),
stock_object_list
[:],
method_id_list
=
(
'z_catalog_stock_list_without_delete_for_inventory_virtual_movement'
,
),
**
catalog_kw
)
**
catalog_kw
)
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