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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
2a772e64
Commit
2a772e64
authored
Feb 14, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an API to create a default price calculation context to computer price.
parent
e8334f14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
product/ERP5/Document/Resource.py
product/ERP5/Document/Resource.py
+12
-0
No files found.
product/ERP5/Document/Resource.py
View file @
2a772e64
...
...
@@ -645,6 +645,16 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
return
-
1
# a defines a destination section and wins
return
1
# a defines no destination section and loses
def
_getPriceCalculationContext
(
self
):
# Tries to find a default context to feed the price calculation
# process. For example, it will set a context in which the
# destination_section is set to the end user the the currency
# to the preferred currency of the end user
method
=
self
.
_getTypeBasedMethod
(
'getPriceCalculationDefaultContext'
)
if
method
is
not
None
:
return
method
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPriceParameterDict'
)
def
getPriceParameterDict
(
self
,
context
=
None
,
REQUEST
=
None
,
...
...
@@ -747,6 +757,8 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
"""
Return the unit price of a resource in a specific context.
"""
if
context
is
None
:
context
=
self
.
Resource_getPriceCalculationDefaultContext
()
# see Movement.getPrice
if
isinstance
(
default
,
Base
)
and
context
is
None
:
msg
=
'getPrice first argument is supposed to be the default value'
\
...
...
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