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
137
Merge Requests
137
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
0d702108
Commit
0d702108
authored
Jan 11, 2018
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_budget: Fix errors/warnings reported by pylint.
parent
b876df9a
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
597 additions
and
533 deletions
+597
-533
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.Budget.py
...entTemplateItem/portal_components/document.erp5.Budget.py
+26
-27
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.Budget.xml
...ntTemplateItem/portal_components/document.erp5.Budget.xml
+31
-12
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetCell.py
...emplateItem/portal_components/document.erp5.BudgetCell.py
+128
-128
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetCell.xml
...mplateItem/portal_components/document.erp5.BudgetCell.xml
+31
-76
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransaction.py
...Item/portal_components/document.erp5.BudgetTransaction.py
+29
-31
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransaction.xml
...tem/portal_components/document.erp5.BudgetTransaction.xml
+31
-16
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransfer.py
...ateItem/portal_components/document.erp5.BudgetTransfer.py
+19
-20
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransfer.xml
...teItem/portal_components/document.erp5.BudgetTransfer.xml
+31
-12
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransferLine.py
...tem/portal_components/document.erp5.BudgetTransferLine.py
+20
-21
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransferLine.xml
...em/portal_components/document.erp5.BudgetTransferLine.xml
+31
-12
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.CategoryBudgetVariation.py
...ortal_components/document.erp5.CategoryBudgetVariation.py
+4
-4
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.CategoryBudgetVariation.xml
...rtal_components/document.erp5.CategoryBudgetVariation.xml
+31
-7
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.NodeBudgetVariation.py
...em/portal_components/document.erp5.NodeBudgetVariation.py
+1
-2
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.NodeBudgetVariation.xml
...m/portal_components/document.erp5.NodeBudgetVariation.xml
+31
-7
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueFeasabilityConstraint.py
...ent.erp5.TransactionQuantityValueFeasabilityConstraint.py
+44
-45
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueFeasabilityConstraint.xml
...nt.erp5.TransactionQuantityValueFeasabilityConstraint.xml
+31
-35
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueValidityConstraint.py
...cument.erp5.TransactionQuantityValueValidityConstraint.py
+34
-36
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueValidityConstraint.xml
...ument.erp5.TransactionQuantityValueValidityConstraint.xml
+31
-31
bt5/erp5_budget/TestTemplateItem/portal_components/test.erp5.testBudget.py
...estTemplateItem/portal_components/test.erp5.testBudget.py
+13
-11
No files found.
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.Budget.py
View file @
0d702108
...
...
@@ -34,33 +34,32 @@ from Products.ERP5.mixin.variated import VariatedMixin
class
Budget
(
Predicate
,
VariatedMixin
):
"""
Budget means a kind of budget stock.
"""
"""
Budget means a kind of budget stock.
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
SimpleItem
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Folder
,
PropertySheet
.
Predicate
,
PropertySheet
.
SortIndex
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Budget
,
PropertySheet
.
Path
,
PropertySheet
.
VariationRange
,
PropertySheet
.
Reference
,
PropertySheet
.
Version
)
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
SimpleItem
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Folder
,
PropertySheet
.
Predicate
,
PropertySheet
.
SortIndex
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Budget
,
PropertySheet
.
Path
,
PropertySheet
.
VariationRange
,
PropertySheet
.
Reference
,
PropertySheet
.
Version
)
# CMF Type Definition
meta_type
=
'ERP5 Budget'
portal_type
=
'Budget'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# CMF Type Definition
meta_type
=
'ERP5 Budget'
portal_type
=
'Budget'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.Budget.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
Budget
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.Budget
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.Budget
</string>
</value>
...
...
@@ -37,15 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 37, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 42, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 60, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 61, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetCell.py
View file @
0d702108
...
...
@@ -35,133 +35,133 @@ from Products.ERP5.Document.MetaNode import MetaNode
from
Products.ERP5.Document.Movement
import
Movement
class
BudgetCell
(
Predicate
,
MetaNode
,
Movement
):
""" Budget Cell defines a cell of budget.
XXX This is not a Movement, but we need getDestinationCredit
XXX This is not a MetaNode
""" Budget Cell defines a cell of budget.
XXX This is not a Movement, but we need getDestinationCredit
XXX This is not a MetaNode
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
SimpleItem
,
PropertySheet
.
Folder
,
PropertySheet
.
Predicate
,
PropertySheet
.
SortIndex
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Amount
,
PropertySheet
.
Budget
,
PropertySheet
.
MappedValue
,
PropertySheet
.
VariationRange
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Cell'
portal_type
=
'Budget Cell'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Return a calculated title.
"""
script
=
self
.
_getTypeBasedMethod
(
'asTitle'
)
if
script
is
not
None
:
return
script
()
raise
UnboundLocalError
(
"Did not find title script for portal type: %r"
%
self
.
getPortalType
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCurrentInventory'
)
def
getCurrentInventory
(
self
,
at_date
=
None
,
**
kw
):
""" Returns current inventory.
at_date parameter can be used to take into account budget transactions
before that date.
"""
kw
[
'node_uid'
]
=
self
.
getUid
()
resource
=
self
.
getResourceValue
()
if
resource
is
not
None
:
kw
[
'resource_uid'
]
=
resource
.
getUid
()
if
at_date
:
kw
[
'at_date'
]
=
at_date
sign
=
self
.
getParentValue
().
BudgetLine_getConsumptionSign
()
return
sign
*
self
.
portal_simulation
.
getCurrentInventory
(
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCurrentBalance'
)
def
getCurrentBalance
(
self
,
at_date
=
None
):
"""
Returns current balance
"""
sign
=
self
.
getParentValue
().
BudgetLine_getConsumptionSign
()
return
sign
*
self
.
getQuantity
(
0.0
)
+
self
.
getCurrentInventory
(
at_date
=
at_date
)
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
SimpleItem
,
PropertySheet
.
Folder
,
PropertySheet
.
Predicate
,
PropertySheet
.
SortIndex
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Amount
,
PropertySheet
.
Budget
,
PropertySheet
.
MappedValue
,
PropertySheet
.
VariationRange
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Cell'
portal_type
=
'Budget Cell'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Return a calculated title.
"""
script
=
self
.
_getTypeBasedMethod
(
'asTitle'
)
if
script
is
not
None
:
return
script
()
raise
UnboundLocalError
,
\
"Did not find title script for portal type: %r"
%
\
self
.
getPortalType
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCurrentInventory'
)
def
getCurrentInventory
(
self
,
at_date
=
None
,
**
kw
):
""" Returns current inventory.
at_date parameter can be used to take into account budget transactions
before that date.
"""
kw
[
'node_uid'
]
=
self
.
getUid
()
resource
=
self
.
getResourceValue
()
if
resource
is
not
None
:
kw
[
'resource_uid'
]
=
resource
.
getUid
()
if
at_date
:
kw
[
'at_date'
]
=
at_date
sign
=
self
.
getParentValue
().
BudgetLine_getConsumptionSign
()
return
sign
*
self
.
portal_simulation
.
getCurrentInventory
(
**
kw
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCurrentBalance'
)
def
getCurrentBalance
(
self
,
at_date
=
None
):
"""
Returns current balance
"""
sign
=
self
.
getParentValue
().
BudgetLine_getConsumptionSign
()
return
sign
*
self
.
getQuantity
(
0.0
)
+
self
.
getCurrentInventory
(
at_date
=
at_date
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConsumedBudget'
)
def
getConsumedBudget
(
self
,
src__
=
0
):
"""
Return consumed budget.
"""
script
=
self
.
_getTypeBasedMethod
(
'getConsumedBudget'
)
if
script
is
not
None
:
return
script
(
src__
=
src__
)
raise
UnboundLocalError
,
\
"Did not find consumed budget script for portal type: %r"
%
\
self
.
getPortalType
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailableBudget'
)
def
getAvailableBudget
(
self
,
at_date
=
None
):
"""
Return available budget.
"""
return
self
.
getCurrentBalance
(
at_date
=
at_date
)
-
self
.
getEngagedBudget
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getEngagedBudget'
)
def
getEngagedBudget
(
self
,
src__
=
0
):
"""
Return Engaged budget.
"""
script
=
self
.
_getTypeBasedMethod
(
'getEngagedBudget'
)
if
script
is
not
None
:
return
script
(
src__
=
src__
)
raise
UnboundLocalError
,
\
"Did not find engaged budget script for portal type: %r"
%
\
self
.
getPortalType
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getExplanationValue'
)
def
getExplanationValue
(
self
,
default
=
None
):
"""Explanation has no meaning for a budget cell"""
return
default
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setSourceCredit'
)
def
setSourceCredit
(
self
,
source_credit
):
"""Set the quantity.
Overloaded from movement, we always set the quantity, even if not passed
"""
try
:
source_credit
=
float
(
source_credit
)
except
TypeError
:
source_credit
=
0.0
Movement
.
setSourceCredit
(
self
,
source_credit
)
def
setSourceDebit
(
self
,
source_debit
):
"""Set the quantity.
Overloaded from movement, we always set the quantity, even if not passed
"""
try
:
source_debit
=
float
(
source_debit
)
except
TypeError
:
source_debit
=
0.0
Movement
.
setSourceDebit
(
self
,
source_debit
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setDestinationDebit'
,
'setDestinationCredit'
)
setDestinationDebit
=
setSourceCredit
setDestinationCredit
=
setSourceDebit
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConsumedBudget'
)
def
getConsumedBudget
(
self
,
src__
=
0
):
"""
Return consumed budget.
"""
script
=
self
.
_getTypeBasedMethod
(
'getConsumedBudget'
)
if
script
is
not
None
:
return
script
(
src__
=
src__
)
raise
UnboundLocalError
(
"Did not find consumed budget script for portal type: %r"
%
self
.
getPortalType
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailableBudget'
)
def
getAvailableBudget
(
self
,
at_date
=
None
):
"""
Return available budget.
"""
return
self
.
getCurrentBalance
(
at_date
=
at_date
)
-
self
.
getEngagedBudget
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getEngagedBudget'
)
def
getEngagedBudget
(
self
,
src__
=
0
):
"""
Return Engaged budget.
"""
script
=
self
.
_getTypeBasedMethod
(
'getEngagedBudget'
)
if
script
is
not
None
:
return
script
(
src__
=
src__
)
raise
UnboundLocalError
(
"Did not find engaged budget script for portal type: %r"
%
self
.
getPortalType
())
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getExplanationValue'
)
def
getExplanationValue
(
self
):
"""Explanation has no meaning for a budget cell"""
return
None
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setSourceCredit'
)
def
setSourceCredit
(
self
,
source_credit
):
"""Set the quantity.
Overloaded from movement, we always set the quantity, even if not passed
"""
try
:
source_credit
=
float
(
source_credit
)
except
TypeError
:
source_credit
=
0.0
Movement
.
setSourceCredit
(
self
,
source_credit
)
def
setSourceDebit
(
self
,
source_debit
):
"""Set the quantity.
Overloaded from movement, we always set the quantity, even if not passed
"""
try
:
source_debit
=
float
(
source_debit
)
except
TypeError
:
source_debit
=
0.0
Movement
.
setSourceDebit
(
self
,
source_debit
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setDestinationDebit'
,
'setDestinationCredit'
)
setDestinationDebit
=
setSourceCredit
setDestinationCredit
=
setSourceDebit
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetCell.xml
View file @
0d702108
This diff is collapsed.
Click to expand it.
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransaction.py
View file @
0d702108
...
...
@@ -32,37 +32,35 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.DeliveryLine
import
DeliveryLine
class
BudgetTransaction
(
DeliveryLine
):
"""
BudgetTransaction an order or transfer of budget.
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Transaction'
portal_type
=
'Budget Transaction'
add_permission
=
Permissions
.
AddPortalContent
"""
BudgetTransaction an order or transfer of budget.
"""
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Transaction'
portal_type
=
'Budget Transaction'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isAccountable'
)
def
isAccountable
(
self
):
"""
Supersedes the DeliveryLine definition
"""
return
1
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isAccountable'
)
def
isAccountable
(
self
):
"""
Supersedes the DeliveryLine definition
"""
return
1
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransaction.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
BudgetTransaction
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.BudgetTransaction
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.BudgetTransaction
</string>
</value>
...
...
@@ -37,19 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 35, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 52, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 53, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 61, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -59,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -78,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -87,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransfer.py
View file @
0d702108
...
...
@@ -33,25 +33,24 @@ from Products.ERP5Type import Permissions, PropertySheet
class
BudgetTransfer
(
Supply
):
"""
BudgetTransfer ...
"""
"""
BudgetTransfer ...
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Folder
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
)
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Folder
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
,
PropertySheet
.
Movement
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Transfer'
portal_type
=
'Budget Transfer'
add_permission
=
Permissions
.
AddPortalContent
# CMF Type Definition
meta_type
=
'ERP5 Budget Transfer'
portal_type
=
'Budget Transfer'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransfer.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
BudgetTransfer
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.BudgetTransfer
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.BudgetTransfer
</string>
</value>
...
...
@@ -37,15 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 36, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 51, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 52, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 53, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 56, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransferLine.py
View file @
0d702108
...
...
@@ -35,24 +35,23 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5.Document.SupplyLine
import
SupplyLine
class
BudgetTransferLine
(
SupplyLine
):
"""
BudgetTransferLine
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Transfer Line'
portal_type
=
'Budget Transfer Line'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
"""
BudgetTransferLine
"""
# Default Properties
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Task
,
PropertySheet
.
Arrow
)
# CMF Type Definition
meta_type
=
'ERP5 Budget Transfer Line'
portal_type
=
'Budget Transfer Line'
add_permission
=
Permissions
.
AddPortalContent
# Declarative security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.BudgetTransferLine.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
BudgetTransferLine
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.BudgetTransferLine
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.BudgetTransferLine
</string>
</value>
...
...
@@ -37,15 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 38, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 43, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 52, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 53, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.CategoryBudgetVariation.py
View file @
0d702108
...
...
@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.BudgetVariation
import
BudgetVariation
class
CategoryBudgetVariation
(
BudgetVariation
):
""" A budget variation based on a category
"""
...
...
@@ -141,7 +140,7 @@ class CategoryBudgetVariation(BudgetVariation):
for
criterion_category
in
context
.
getMembershipCriterionCategoryList
():
if
'/'
not
in
criterion_category
:
# safe ...
continue
criterion_base_category
,
category_url
=
criterion_category
.
split
(
'/'
,
1
)
criterion_base_category
,
_
=
criterion_category
.
split
(
'/'
,
1
)
if
criterion_base_category
==
base_category
:
if
uid_based_axis
:
category_uid
=
self
.
getPortalObject
().
portal_categories
\
...
...
@@ -184,8 +183,9 @@ class CategoryBudgetVariation(BudgetVariation):
axis
=
'%s_uid'
%
axis
if
self
.
getProperty
(
'full_consumption_detail'
):
for
title
,
category
in
self
.
getBudgetLineVariationRangeCategoryList
(
context
):
if
not
category
:
continue
for
_
,
category
in
self
.
getBudgetLineVariationRangeCategoryList
(
context
):
if
not
category
:
continue
if
axis
.
endswith
(
'_uid'
):
# XXX move out getattrs
category
=
self
.
getPortalObject
().
portal_categories
\
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.CategoryBudgetVariation.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
CategoryBudgetVariation
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.CategoryBudgetVariation
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.CategoryBudgetVariation
</string>
</value>
...
...
@@ -37,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:144, 31: Unused variable \'category_url\' (unused-variable)
</string>
<string>
W:187, 10: Unused variable \'title\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -50,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -69,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.NodeBudgetVariation.py
View file @
0d702108
...
...
@@ -33,7 +33,6 @@ from erp5.component.document.BudgetVariation import BudgetVariation
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
,
ComplexQuery
class
NodeBudgetVariation
(
BudgetVariation
):
""" A budget variation for node
...
...
@@ -282,7 +281,7 @@ class NodeBudgetVariation(BudgetVariation):
found
=
False
for
node_url
in
category_list
:
if
node_url
!=
'%s/budget_special_node/none'
%
base_category
:
__traceback_info__
=
(
node_url
,
)
__traceback_info__
=
(
node_url
,
)
# pylint: disable=unused-variable
if
uid_based_axis
:
query_dict
.
setdefault
(
axis
,
[]).
append
(
portal_categories
.
getCategoryValue
(
node_url
,
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.NodeBudgetVariation.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
NodeBudgetVariation
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.NodeBudgetVariation
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.NodeBudgetVariation
</string>
</value>
...
...
@@ -37,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:133, 6: Unused variable \'consumption_dict\' (unused-variable)
</string>
<string>
W:284, 8: Unused variable \'__traceback_info__\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -50,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -69,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueFeasabilityConstraint.py
View file @
0d702108
...
...
@@ -27,54 +27,53 @@
##############################################################################
from
Products.ERP5Type.mixin.constraint
import
ConstraintMixin
from
Products.ERP5Type
import
PropertySheet
class
TransactionQuantityValueFeasabilityConstraint
(
ConstraintMixin
):
"""
Check if the quantity of the transaction is possible
for the source and the destination
This is only relevant for ZODB Property Sheets (filesystem Property
Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueFeasability
instead).
"""
meta_type
=
'ERP5 Transaction Quantity Value Feasability Constraint'
portal_type
=
'Transaction Quantity Value Feasability Constraint'
def
_checkConsistency
(
self
,
obj
,
fixit
=
0
,
**
_
):
"""
Check if the quantity of the transaction is possible
for the source and the destination
This is only relevant for ZODB Property Sheets (filesystem Property
Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueFeasability
instead).
"""
meta_type
=
'ERP5 Transaction Quantity Value Feasability Constraint'
portal_type
=
'Transaction Quantity Value Feasability Constraint'
def
_checkConsistency
(
self
,
object
,
fixit
=
0
):
"""
Check if the quantity of the transaction is possible
for the source and the destination
"""
errors
=
[]
source_cell
=
object
.
getSourceValue
()
destination_cell
=
object
.
getDestinationValue
()
# Check for source and destination
for
node
,
sign
,
node_title
in
((
source_cell
,
1
,
'source'
),
(
destination_cell
,
-
1
,
'destination'
)):
# As the quantity can change a few lines letter,
# we need to get it each time.
object_quantity
=
object
.
getQuantity
()
quantity
=
object_quantity
*
sign
if
node
is
not
None
:
balance
=
node
.
getCurrentBalance
()
is_transaction_ok
=
1
# Check if balance and quantity have the same sign
if
((
balance
<
0
)
and
(
quantity
<
0
)):
if
balance
>
quantity
:
is_transaction_ok
=
0
elif
((
balance
>=
0
)
and
(
quantity
>=
0
)):
if
balance
<
quantity
:
is_transaction_ok
=
0
# Raise error
if
not
is_transaction_ok
:
if
fixit
!=
0
:
object
.
setQuantity
(
balance
)
else
:
error_message
=
'The quantity "%s" of the transaction is not '
\
'compatible with budget "%s" defined on the '
\
'%s "%s".'
%
\
(
object_quantity
,
balance
,
node_title
,
node
)
# Add error
errors
.
append
(
self
.
_generateError
(
object
,
error_message
))
return
errors
errors
=
[]
source_cell
=
obj
.
getSourceValue
()
destination_cell
=
obj
.
getDestinationValue
()
# Check for source and destination
for
node
,
sign
,
node_title
in
((
source_cell
,
1
,
'source'
),
(
destination_cell
,
-
1
,
'destination'
)):
# As the quantity can change a few lines letter,
# we need to get it each time.
object_quantity
=
obj
.
getQuantity
()
quantity
=
object_quantity
*
sign
if
node
is
not
None
:
balance
=
node
.
getCurrentBalance
()
is_transaction_ok
=
1
# Check if balance and quantity have the same sign
if
((
balance
<
0
)
and
(
quantity
<
0
)):
if
balance
>
quantity
:
is_transaction_ok
=
0
elif
((
balance
>=
0
)
and
(
quantity
>=
0
)):
if
balance
<
quantity
:
is_transaction_ok
=
0
# Raise error
if
not
is_transaction_ok
:
if
fixit
!=
0
:
obj
.
setQuantity
(
balance
)
else
:
error_message
=
'The quantity "%s" of the transaction is not '
\
'compatible with budget "%s" defined on the '
\
'%s "%s".'
%
\
(
object_quantity
,
balance
,
node_title
,
node
)
# Add error
errors
.
append
(
self
.
_generateError
(
obj
,
error_message
))
return
errors
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueFeasabilityConstraint.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
TransactionQuantityValueFeasabilityConstraint
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.TransactionQuantityValueFeasabilityConstraint
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.TransactionQuantityValueFeasabilityConstraint
</string>
</value>
...
...
@@ -37,38 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 33, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 42, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 44, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 45, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 49, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 50, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 51, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 53, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 60, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 61, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 14 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 66, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 68, 0: Bad indentation. Found 14 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 70, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 72, 0: Bad indentation. Found 14 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 73, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 74, 0: Bad indentation. Found 14 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 79, 0: Bad indentation. Found 14 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 44, 32: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W: 44, 4: Arguments number differs from overridden \'_checkConsistency\' method (arguments-differ)
</string>
<string>
W: 30, 0: Unused PropertySheet imported from Products.ERP5Type (unused-import)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -78,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -97,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -106,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueValidityConstraint.py
View file @
0d702108
...
...
@@ -27,46 +27,44 @@
##############################################################################
from
Products.ERP5Type.mixin.constraint
import
ConstraintMixin
from
Products.ERP5Type
import
PropertySheet
class
TransactionQuantityValueValidityConstraint
(
ConstraintMixin
):
"""
This is only relevant for ZODB Property Sheets (filesystem Property
Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueValidity
instead).
"""
meta_type
=
'ERP5 Transaction Quantity Value Validity Constraint'
portal_type
=
'Transaction Quantity Value Validity Constraint'
def
_checkConsistency
(
self
,
obj
,
fixit
=
0
,
**
_
):
"""
This is only relevant for ZODB Property Sheets (filesystem Property
Sheets rely on Products.ERP5.Constraint.TransactionQuantityValueValidity
instead).
Check if the quantity of the transaction is greater than the
balance of the source.
"""
meta_type
=
'ERP5 Transaction Quantity Value Validity Constraint'
portal_type
=
'Transaction Quantity Value Validity Constraint'
def
_checkConsistency
(
self
,
object
,
fixit
=
0
):
"""
Check if the quantity of the transaction is greater than the
balance of the source.
"""
errors
=
[]
errors
=
[]
source_cell
=
object
.
getSourceValue
()
destination_cell
=
object
.
getDestinationValue
()
source_cell
=
obj
.
getSourceValue
()
destination_cell
=
obj
.
getDestinationValue
()
if
(
source_cell
is
not
None
)
and
\
(
destination_cell
is
not
None
):
# XXX Dirty code !
quantity
=
object
.
getQuantity
()
budget_list
=
object
.
getPortalObject
().
budget_module
.
objectValues
()
max_quantity
=
0
for
obj
in
budget_list
:
for
item
in
obj
.
objectValues
():
if
(
item
.
getPortalType
()
==
'Budget Transfer Line'
)
and
\
(
item
.
getSourceValue
()
==
source_cell
)
and
\
(
item
.
getDestinationValue
()
==
destination_cell
):
max_quantity
=
item
.
getQuantity
()
if
quantity
>
max_quantity
:
if
fixit
!=
0
:
self
.
setQuantity
(
max_quantity
)
else
:
error_message
=
'The quantity of the transaction is greater than '
\
'the transferable maximum quantity (TMQ): '
\
if
source_cell
is
not
None
and
destination_cell
is
not
None
:
# XXX Dirty code !
quantity
=
obj
.
getQuantity
()
budget_list
=
obj
.
getPortalObject
().
budget_module
.
objectValues
()
max_quantity
=
0
for
obj
in
budget_list
:
for
item
in
obj
.
objectValues
():
if
item
.
getPortalType
()
==
'Budget Transfer Line'
and
\
item
.
getSourceValue
()
==
source_cell
and
\
item
.
getDestinationValue
()
==
destination_cell
:
max_quantity
=
item
.
getQuantity
()
if
quantity
>
max_quantity
:
if
fixit
!=
0
:
self
.
setQuantity
(
max_quantity
)
else
:
error_message
=
'The quantity of the transaction is greater than '
\
'the transferable maximum quantity (TMQ): '
\
'TMQ = %.2f'
%
max_quantity
# Add error
errors
.
append
(
self
.
_generateError
(
object
,
error_message
))
return
errors
# Add error
errors
.
append
(
self
.
_generateError
(
obj
,
error_message
))
return
errors
\ No newline at end of file
bt5/erp5_budget/DocumentTemplateItem/portal_components/document.erp5.TransactionQuantityValueValidityConstraint.xml
View file @
0d702108
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
TransactionQuantityValueValidityConstraint
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.TransactionQuantityValueValidityConstraint
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.TransactionQuantityValueValidityConstraint
</string>
</value>
...
...
@@ -37,34 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 33, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 38, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 39, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 42, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 46, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 48, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 49, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 51, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 55, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 56, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 13 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 62, 0: Bad indentation. Found 15 spaces, expected 12 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 66, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)
</string>
<string>
W: 72, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 41, 32: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W: 41, 4: Arguments number differs from overridden \'_checkConsistency\' method (arguments-differ)
</string>
<string>
W: 30, 0: Unused PropertySheet imported from Products.ERP5Type (unused-import)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -74,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -93,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -102,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_budget/TestTemplateItem/portal_components/test.erp5.testBudget.py
View file @
0d702108
...
...
@@ -85,7 +85,7 @@ class TestBudget(ERP5TypeTestCase):
budget
=
self
.
portal
.
budget_module
.
newContent
(
portal_type
=
'Budget'
)
budget_line
=
budget
.
newContent
(
portal_type
=
'Budget Line'
)
budget_
cell
=
budget_
line
.
newContent
(
portal_type
=
'Budget Cell'
)
budget_line
.
newContent
(
portal_type
=
'Budget Cell'
)
self
.
assertEqual
([],
budget
.
checkConsistency
())
def
test_budget_cell_node_variation_with_aggregate
(
self
):
...
...
@@ -626,17 +626,18 @@ class TestBudget(ERP5TypeTestCase):
self
.
assertEqual
(
2
,
len
(
budget_line
.
contentValues
()))
test_class_self
=
self
class
ReferenceQuery
:
"""Helper class to compare queries
"""
def
__eq__
(
me
,
query
):
self
.
assertTrue
(
isinstance
(
query
,
ComplexQuery
))
self
.
assertEqual
(
query
.
logical_operator
,
'or'
)
self
.
assertEqual
(
2
,
len
(
query
.
query_list
))
self
.
assertEqual
(
query
.
query_list
[
0
].
kw
,
{
'project_uid'
:
None
})
self
.
assertEqual
(
query
.
query_list
[
1
].
kw
,
def
__eq__
(
self
,
query
):
test_class_
self
.
assertTrue
(
isinstance
(
query
,
ComplexQuery
))
test_class_
self
.
assertEqual
(
query
.
logical_operator
,
'or'
)
test_class_
self
.
assertEqual
(
2
,
len
(
query
.
query_list
))
test_class_
self
.
assertEqual
(
query
.
query_list
[
0
].
kw
,
{
'project_uid'
:
None
})
test_class_
self
.
assertEqual
(
query
.
query_list
[
1
].
kw
,
{
'project_uid'
:
[
self
.
portal
.
organisation_module
.
my_organisation
.
getUid
()]})
[
test_class_
self
.
portal
.
organisation_module
.
my_organisation
.
getUid
()]})
return
True
self
.
assertEqual
(
...
...
@@ -730,12 +731,13 @@ class TestBudget(ERP5TypeTestCase):
self
.
assertEqual
(
1
,
len
(
budget_line
.
contentValues
()))
test_class_self
=
self
class
ReferenceQuery
:
"""Helper class to compare queries
"""
def
__eq__
(
me
,
query
):
self
.
assertTrue
(
isinstance
(
query
,
Query
))
self
.
assertEqual
(
query
.
kw
,
{
'project_uid'
:
None
})
def
__eq__
(
self
,
query
):
test_class_
self
.
assertTrue
(
isinstance
(
query
,
Query
))
test_class_
self
.
assertEqual
(
query
.
kw
,
{
'project_uid'
:
None
})
return
True
self
.
assertEqual
(
...
...
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