Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
4ded81e2
Commit
4ded81e2
authored
Sep 21, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Override _edit function for Patch Item to create path and property item to store values
parent
8a0ca10b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+32
-0
No files found.
product/ERP5/Document/BusinessManager.py
View file @
4ded81e2
...
...
@@ -1151,6 +1151,38 @@ class BusinesPatchItem(XMLObject):
isProperty
=
False
constructors
=
(
manage_addBusinessPatchItem
,)
def
_edit
(
self
,
**
kw
):
"""
Override _edit to create Business Item and BusinessPropertyItem for old and
new value
"""
super
(
BusinessPatchItem
,
self
).
_edit
(
**
kw
)
item_path
=
kw
.
get
(
'item_path'
,
None
)
dependency_list
=
kw
.
get
(
'dependency_list'
,
[])
if
item_path
:
# Check if there is already a Business Item or Business Property Item
# existing with this path
# XXX: Add some attribute to restrict installation of these item(s),
# they should add as hidden item(s)
new_item
=
self
.
getBusinessItemByPath
(
item_path
+
'_new'
)
old_item
=
self
.
getBusinessItemByPath
(
item_path
+
'_old'
)
# If there is already new or old value, remove it
if
new_item
:
self
.
manage_delObjects
([
new_item
.
getId
()])
if
old_item
:
self
.
manage_delObjects
([
old_item
.
getId
()])
# Use item_path to determine if we need to create Business Item or
# Business Property Item for storing old and new values
if
'#'
in
item_path
:
self
.
newContent
(
portal_type
=
'Business Property Item'
,
item_path
=
item_path
)
else
:
self
.
newContent
(
portal_type
=
'Business Item'
,
item_path
=
item_path
)
def
build
(
self
,
context
,
**
kw
):
"""
Build should update the old and new 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