Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
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
Romain Courteaud
slapos.core
Commits
bd5bfca7
Commit
bd5bfca7
authored
May 10, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: searchAndActivate cannot receive uid
Simplify the alarm call to not re-query more them once.
parent
e3c2f5ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
19 deletions
+22
-19
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
..._accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
+2
-7
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/ERP5Site_zGetOpenOrderWithModifiedLineUid.sql
..._accounting/ERP5Site_zGetOpenOrderWithModifiedLineUid.sql
+3
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
...os_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
+12
-7
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
...s_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
+1
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
.../portal_components/test.erp5.testSlapOSAccountingAlarm.py
+4
-2
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
View file @
bd5bfca7
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
for
line
in
portal
.
ERP5Site_zGetOpenOrderWithModifiedLineUid
():
method_id
=
'OpenSaleOrder_reindexIfIndexedBeforeLine'
,
context
.
activate
(
activity
=
"SQLQueue"
,
tag
=
tag
).
OpenSaleOrder_reindexIfIndexedBeforeLine
(
uid
=
line
.
uid
)
portal_type
=
"Open Sale Order"
,
children_portal_type
=
"Open Sale Order Line"
,
uid
=
[
i
.
uid
for
i
in
portal
.
ERP5Site_zGetOpenOrderWithModifiedLineUid
()],
activate_kw
=
{
'tag'
:
tag
},
)
context
.
activate
(
after_tag
=
tag
).
getId
()
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/ERP5Site_zGetOpenOrderWithModifiedLineUid.sql
View file @
bd5bfca7
...
@@ -8,7 +8,8 @@ WHERE
...
@@ -8,7 +8,8 @@ WHERE
AND
open_sale_order_line_catalog
.
path
!=
'reserved'
AND
open_sale_order_line_catalog
.
path
!=
'reserved'
AND
catalog
.
portal_type
=
"Open Sale Order"
AND
catalog
.
portal_type
=
"Open Sale Order"
AND
catalog
.
uid
=
open_sale_order_line_catalog
.
parent_uid
AND
catalog
.
uid
=
open_sale_order_line_catalog
.
parent_uid
AND
catalog
.
validation_state
IN
(
'draft'
,
'validated'
,
'archived'
)
AND
open_sale_order_line_catalog
.
portal_type
=
"Open Sale Order Line"
AND
open_sale_order_line_catalog
.
portal_type
=
"Open Sale Order Line"
AND
open_sale_order_line_catalog
.
indexation_timestamp
>
catalog
.
indexation_timestamp
AND
open_sale_order_line_catalog
.
indexation_timestamp
>
=
catalog
.
indexation_timestamp
group
by
group
by
catalog
.
uid
catalog
.
uid
\ No newline at end of file
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
View file @
bd5bfca7
...
@@ -2,17 +2,22 @@ from zExceptions import Unauthorized
...
@@ -2,17 +2,22 @@ from zExceptions import Unauthorized
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
raise
Unauthorized
order
=
context
if
uid
is
None
:
uid
=
context
.
getUid
()
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
indexation_timestamp
=
portal
.
portal_catalog
(
uid
=
order
.
getUid
(),
order
=
portal
.
portal_catalog
(
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
].
indexation_timestamp
uid
=
uid
,
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
]
indexation_timestamp
=
order
.
indexation_timestamp
line_list
=
portal
.
portal_catalog
(
line_list
=
portal
.
portal_catalog
(
portal_type
=
"Open Sale Order Line"
,
portal_type
=
"Open Sale Order Line"
,
parent_uid
=
order
.
getUid
()
,
parent_uid
=
uid
,
indexation_timestamp
=
{
'query'
:
indexation_timestamp
,
'range'
:
'nlt'
},
indexation_timestamp
=
{
'query'
:
indexation_timestamp
,
'range'
:
'nlt'
},
limit
=
1
)
limit
=
1
)
if
len
(
line_list
):
if
len
(
line_list
):
order
.
activate
().
immediateReindexObject
()
order
.
getObject
().
activate
().
immediateReindexObject
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
View file @
bd5bfca7
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
<value>
<string>
uid=None,
REQUEST=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingAlarm.py
View file @
bd5bfca7
...
@@ -1359,10 +1359,11 @@ class TestSlapOSReindexOpenSaleOrder(SlapOSTestCaseMixin):
...
@@ -1359,10 +1359,11 @@ class TestSlapOSReindexOpenSaleOrder(SlapOSTestCaseMixin):
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
script_name
,
'*args, **kwargs'
,
'
uid=None,
*args, **kwargs'
,
'# Script body
\
n
'
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by OpenSaleOrder_reindexIfIndexedBeforeLine') """
)
open_order = context.portal_catalog.getResultValue(uid=uid)
portal_workflow.doActionFor(open_order, action='edit_action', comment='Visited by OpenSaleOrder_reindexIfIndexedBeforeLine') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropOpenSaleOrder_reindexIfIndexedBeforeLine
(
self
):
def
_dropOpenSaleOrder_reindexIfIndexedBeforeLine
(
self
):
...
@@ -1373,6 +1374,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O
...
@@ -1373,6 +1374,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O
def
test_alarm
(
self
):
def
test_alarm
(
self
):
open_order
=
self
.
createOpenOrder
()
open_order
=
self
.
createOpenOrder
()
self
.
tic
()
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
open_order
.
newContent
(
portal_type
=
"Open Sale Order Line"
)
self
.
tic
()
self
.
tic
()
self
.
_simulateOpenSaleOrder_reindexIfIndexedBeforeLine
()
self
.
_simulateOpenSaleOrder_reindexIfIndexedBeforeLine
()
...
...
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