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
864aa413
Commit
864aa413
authored
Sep 22, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: only automate invoice with automated ledger
parent
1bfde9b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
39 deletions
+2
-39
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
...ng/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
+1
-17
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
...Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
+1
-22
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
View file @
864aa413
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
trade_condition_uid_list
=
[]
# search for user specific trade conditions
root_trade_condition_uid_list
=
[
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()).
getUid
(),
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()).
getUid
()]
trade_condition_uid_list
.
extend
(
root_trade_condition_uid_list
)
trade_condition_uid_list
.
extend
([
i
.
uid
for
i
in
portal
.
ERP5Site_searchRelatedInheritedSpecialiseList
(
portal_type
=
"Sale Trade Condition"
,
specialise_uid
=
root_trade_condition_uid_list
,
validation_state
=
"validated"
)])
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Sale Invoice Transaction'
,
simulation_state
=
'confirmed'
,
causality_state
=
'solved'
,
specialise__uid
=
trade_condition_uid_list
,
ledger__uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
,
method_id
=
'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
View file @
864aa413
...
...
@@ -3,32 +3,11 @@ if context.getPortalType() != 'Sale Invoice Transaction':
raise
TypeError
(
'Incorrect delivery.'
)
isTransitionPossible
=
portal
.
portal_workflow
.
isTransitionPossible
if
context
.
getSimulationState
()
==
'confirmed'
\
and
context
.
getLedger
()
==
'automated'
\
and
len
(
context
.
checkConsistency
())
==
0
\
and
context
.
getCausalityState
()
==
'solved'
\
and
len
(
context
.
objectValues
(
portal_type
=
"Sale Invoice Transaction Line"
)):
if
context
.
getSpecialise
()
not
in
[
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
(),
portal
.
portal_preferences
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()]:
trade_condition_uid_list
=
[]
# search for user specific trade conditions
root_trade_condition_uid_list
=
[
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSubscriptionSaleTradeCondition
()).
getUid
(),
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()).
getUid
()]
trade_condition_uid_list
.
extend
(
root_trade_condition_uid_list
)
trade_condition_uid_list
.
extend
([
i
.
uid
for
i
in
portal
.
ERP5Site_searchRelatedInheritedSpecialiseList
(
portal_type
=
"Sale Trade Condition"
,
specialise_uid
=
root_trade_condition_uid_list
,
validation_state
=
"validated"
)])
if
context
.
getSpecialiseUid
()
not
in
trade_condition_uid_list
:
return
comment
=
'Stopped by alarm as all actions in confirmed state are ready.'
if
isTransitionPossible
(
context
,
'start'
):
context
.
start
(
comment
=
comment
)
...
...
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