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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
842d5f60
Commit
842d5f60
authored
Jul 07, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdm: supply line quantity unit WIP
parent
4f452ca4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
...skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
+16
-1
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.py
...plateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.py
+4
-3
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.py
...plateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.py
+4
-3
No files found.
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Resource_getPriceCalculationOperandDict.py
View file @
842d5f60
...
...
@@ -76,7 +76,22 @@ unit_base_price *= 1 + result["surcharge_ratio"]
# Divide by the priced quantity
priced_quantity
=
result
[
'priced_quantity'
]
if
priced_quantity
:
# If this priced quantity is in a different quantity unit from the
# resource's default quantity unit, we have to convert this quantity
# to the resource quantity unit.
# For example, if we have a resource managed in Kilogram and we have
# a supply line saying that the price for 250 Grams is 100€, we adjust this
# priced quantity to be 0.25 (Kilogram)
supply_line_quantity_unit
=
next
(
iter
(
result
.
get
(
'quantity_unit'
,
())),
None
)
resource_default_quantity_unit
=
context
.
getDefaultQuantityUnit
()
if
resource_default_quantity_unit
!=
supply_line_quantity_unit
:
priced_quantity
=
context
.
convertQuantity
(
priced_quantity
or
1
,
supply_line_quantity_unit
,
resource_default_quantity_unit
,
movement
.
getVariationCategoryList
()
)
if
priced_quantity
and
priced_quantity
!=
1
:
unit_base_price
/=
priced_quantity
result
[
"price"
]
=
unit_base_price
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.py
View file @
842d5f60
...
...
@@ -35,9 +35,10 @@ if context.getParentValue().getParentValue().getPortalType() in (
#backwards compatibility
mapped_value_property_list
=
context
.
getMappedValuePropertyList
()
if
not
'priced_quantity'
in
mapped_value_property_list
:
mapped_value_property_list
.
append
(
'priced_quantity'
)
context
.
setMappedValuePropertyList
(
mapped_value_property_list
)
for
mapped_property
in
(
'priced_quantity'
,
'quantity_unit'
):
if
not
mapped_property
in
mapped_value_property_list
:
mapped_value_property_list
.
append
(
mapped_property
)
context
.
setMappedValuePropertyList
(
mapped_value_property_list
)
# XXX: An hack that the context cell may not have the start_date_range_min/max properties.
# But they don't acquire it parent the properties.
...
...
bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.py
View file @
842d5f60
...
...
@@ -36,9 +36,10 @@ if context.getParentValue().getPortalType() in (
#backwards compatibility
mapped_value_property_list
=
context
.
getMappedValuePropertyList
()
if
not
'priced_quantity'
in
mapped_value_property_list
:
mapped_value_property_list
.
append
(
'priced_quantity'
)
context
.
setMappedValuePropertyList
(
mapped_value_property_list
)
for
mapped_property
in
(
'priced_quantity'
,
'quantity_unit'
):
if
not
mapped_property
in
mapped_value_property_list
:
mapped_value_property_list
.
append
(
mapped_property
)
context
.
setMappedValuePropertyList
(
mapped_value_property_list
)
return
context
.
generatePredicate
(
membership_criterion_base_category_list
=
base_category_tuple
,
criterion_property_list
=
(
'start_date'
,))
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