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
Klaus Wölfel
erp5
Commits
79b3e330
Commit
79b3e330
authored
Dec 18, 2018
by
Julien Muchembled
Committed by
Your Name
Mar 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not hardcode computation of start/stop dates
Let's use reference_date_method_id on Trade Model Paths.
parent
b9a313b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
63 deletions
+3
-63
bt5/erp5_real_time_inventory_accounting/DocumentTemplateItem/portal_components/document.erp5.InventoryAssetPriceAccountingSimulationRule.py
...ument.erp5.InventoryAssetPriceAccountingSimulationRule.py
+3
-63
No files found.
bt5/erp5_real_time_inventory_accounting/DocumentTemplateItem/portal_components/document.erp5.InventoryAssetPriceAccountingSimulationRule.py
View file @
79b3e330
...
...
@@ -37,63 +37,6 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(
meta_type
=
'ERP5 Inventory Asset Price Accounting Simulation Rule'
portal_type
=
'Inventory Asset Price Accounting Simulation Rule'
# XXX: Copy/paste from Products.ERP5.mixin.rule to support Transit use case
def
getGeneratedMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
"""
Returns a list of movements generated by that rule.
movement_list - optional IMovementList which can be passed explicitely
rounding - boolean argument, which controls if rounding shall be applied on
generated movements or not
NOTE:
- implement rounding appropriately (True or False seems
simplistic)
"""
# Default implementation below can be overriden by subclasses
# however it should be generic enough not to be overriden
# by most classes
# Results will be appended to result
result
=
[]
# Build a list of movement and business path
input_movement_list
=
self
.
_getInputMovementList
(
movement_list
=
movement_list
,
rounding
=
rounding
)
for
input_movement
in
input_movement_list
:
# Merge movement and business path properties (core implementation)
# Lookup Business Process through composition (NOT UNION)
business_process
=
input_movement
.
asComposedDocument
()
explanation
=
self
.
_applied_rule
# We use applied rule as local explanation
trade_phase
=
self
.
_getTradePhaseList
(
input_movement
,
business_process
)
# XXX-JPS not convenient to handle
update_property_dict
=
self
.
_getUpdatePropertyDict
(
input_movement
)
for
movement
in
business_process
.
getTradePhaseMovementList
(
explanation
,
input_movement
,
trade_phase
=
trade_phase
,
delay_mode
=
None
,
update_property_dict
=
update_property_dict
):
# PATCH-BEGIN
update_dict
=
{}
if
movement
.
getLedger
()
in
(
'stock/stock/entree'
,
'stock/transit/sortie'
,
'stock/customs/entree'
):
update_dict
[
'start_date'
]
=
update_dict
[
'stop_date'
]
=
input_movement
.
getStopDate
()
elif
movement
.
getLedger
()
in
(
'stock/preparation/sortie'
,
'stock/transit/entree'
):
update_dict
[
'start_date'
]
=
update_dict
[
'stop_date'
]
=
input_movement
.
getStartDate
()
movement
.
_edit
(
**
update_dict
)
input_movement
.
log
(
"%r (input_movement=%r): ledger=%r, start_date=%r, stop_date=%r"
%
(
movement
,
input_movement
,
movement
.
getLedger
(),
movement
.
getStartDate
(),
movement
.
getStopDate
()))
# PATCH-END
result
.
append
(
movement
)
# And return list of generated movements
return
result
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
simulation_movement
=
self
.
_applied_rule
.
getParentValue
()
...
...
@@ -102,8 +45,6 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(
if
base_price
is
None
:
return
[]
quantity
=
simulation_movement
.
getCorrectedQuantity
()
*
base_price
if
quantity
is
None
:
return
[]
return
[
simulation_movement
.
asContext
(
quantity
=
quantity
)]
...
...
@@ -112,10 +53,9 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(
self
,
input_movement
)
if
input_movement
.
getRootAppliedRule
().
getCausalityValue
().
getPortalType
().
startswith
(
'Purchase'
):
update_property_dict
[
'source_section'
]
=
input_movement
.
getDestinationSection
()
if
not
input_movement
.
getSourceSection
():
order
=
input_movement
.
getRootAppliedRule
().
getCausalityValue
()
if
(
order
.
getPortalType
().
startswith
(
'Purchase'
)
or
not
input_movement
.
getSourceSection
()):
update_property_dict
[
'source_section'
]
=
input_movement
.
getDestinationSection
()
resource
=
input_movement
.
getSourceAssetPriceCurrency
()
...
...
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